Polymer / polymer

Our original Web Component library.
https://polymer-library.polymer-project.org/
BSD 3-Clause "New" or "Revised" License
22.05k stars 2.01k forks source link

Adding Polymer library to KnockoutJS app causes "DOM Exception 8" on all browsers but Chrome #1476

Closed prokilogrammer closed 8 years ago

prokilogrammer commented 9 years ago

Example here: http://jsfiddle.net/tffLkkzt/9/. Hit run on non-Chrome browser, say Safari, and check the console. I get this error NotFoundError: DOM Exception 8: An attempt was made to reference a Node in a context where it does not exist. If I remove Polymer and Webcomponent.js, everything works fine.

This problem happens only when a text knockout binding is used on an empty element. Example: <div data-bind="text: data"></div>

In this case, when processing the text binding, Knockout tries to insert a TextNode into the div using node.appendChild(). But its reference to node seem to be bad/out-of-date and causes DOM Exception 8. Here is the line in Knockout code where this happens: https://github.com/knockout/knockout/blob/09dae4db720d28cf85a1cad87f2fca95a3eed79d/dist/knockout.debug.js#L280

PS: On Firefox, the error is TypeError: Argument 1 of Node.appendChild does not implement interface Node.. But it is thrown for exactly for the same reason and at the same line in knockout code.

tjsavage commented 8 years ago

Closing this issue due to age and the release of version 1 of Polymer - please feel free to re-open if this is incorrect.