Raynos / mercury

A truly modular frontend framework
http://raynos.github.io/mercury/
MIT License
2.82k stars 142 forks source link

Exception when initializing an app on an element with the same tag name #136

Closed matthewp closed 9 years ago

matthewp commented 9 years ago

This happened when I upgraded from 12.0 to 14.0.

My code is basically the same as shown here: https://github.com/Raynos/mercury/blob/master/examples/server-rendering/browser.js#L28

If targetElem has the same tagName as the element returns by render you get the exception:

Uncaught SyntaxError: Failed to set the 'contentEditable' property on 'HTMLElement': The value provided ('') is not one of 'true', 'false', 'plaintext-only', or 'inherit'.

The error occurs here: https://github.com/Matt-Esch/virtual-dom/blob/master/vdom/apply-properties.js#L43

It attempts to set node['contentEditable'] = '' which I guess is invalid so the browser throws.

Not sure what caused this error to happen. I'm not using contenteditable, that must be the default value in the browser and virtual-dom is mistakenly diffing it. What is the proper fix for this? Should I file in virtual-dom?

kumavis commented 9 years ago

hmm im not sure -- try the hg.app(document.body, app, render, opts) signature?

matthewp commented 9 years ago

Same result.

kumavis commented 9 years ago

if you leave out initialTree https://github.com/Raynos/mercury/blob/master/examples/server-rendering/browser.js#L32 does it work? if so maybe vdom-virtualize needs to be in sync with mercury/node_modules/vdom

Raynos commented 9 years ago

This is probably a bug in vdom-virtualize. There was an issue about contentEditable on virtual-dom as well.

Raynos commented 9 years ago

https://github.com/Matt-Esch/virtual-dom/issues/176

Raynos commented 9 years ago

Actually this is a bug in virtual-dom.

matthewp commented 9 years ago

Great, will track there then, thanks.