choojs / nanomorph

🚅 - Hyper fast diffing algorithm for real DOM nodes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

test attribute copying

yoshuawuyts opened this issue · comments

commented

We're testing SVG namespaces and events, but not regular ol' attributes. I've been running into issues on the server with this, so we should probably test this. Would also help enable #37 as we need to read and write attributes.

Specifically it'd be nice if tests could hit el.setAttribute() and el.getAttribute(). Thanks!

commented

Had a <div data-something="foo"> and a <div data-something-else="bar">, merged em and the result had both properties. Obv something is not going alright there :(

commented

What is the expected behavior in that example?
Are you thinking the attribute logic should:
see if the attr exists on old but not on new then nuke it
see if the attr exists on new and old, then update to the new value if they are not the same

Is there ever a case where you would want to retain the old attrs?

commented
commented

That was my inclination as well.

I checked the code and it seems to at least logically follow the cases I described above.

Will add some more tests to try and get to the bottom of it.