Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update(old, new) #9

Closed
nrn opened this issue Mar 4, 2016 · 3 comments
Closed

update(old, new) #9

nrn opened this issue Mar 4, 2016 · 3 comments

Comments

@nrn
Copy link

nrn commented Mar 4, 2016

Any thoughts on trasitioning update to being a function that takes the old element as it's first argument, instead of adding a property to the element? It feels like it would fit better with my expectations approaching the interface. And it seems like you could then update elements not created by bel, which would be nice.

@shama
Copy link
Member

shama commented Mar 4, 2016

That could be done by using morphdom or diffhtml directly:

var bel = require('bel')
var element = bel`<div>hello</div>`

// ... later ...

var morphdom = require('morphdom')
var newelement = bel`<div>changed</div>`
morphdom(element, newelement)

But I have it tied to the element to encourage data down, actions up. I'd be worried about elements getting updated by multiple sources and conflicting with each other.

@nrn
Copy link
Author

nrn commented Mar 4, 2016

It is surprising to me for real dom elements to have extra methods on them, but it totally makes sense why you're going that way!

@nrn nrn closed this as completed Mar 4, 2016
@shama
Copy link
Member

shama commented Mar 4, 2016

I considered replacing .outerHTML with a setter to the update function but wasn't sure if that was a good idea or not. See #6

Maybe better wording would be, "almost pure elements." :)

@shama shama mentioned this issue Mar 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants