polymer icon indicating copy to clipboard operation
polymer copied to clipboard

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

Open prokilogrammer opened this issue 11 years ago • 1 comments

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.

prokilogrammer avatar May 01 '15 21:05 prokilogrammer

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

tjsavage avatar Oct 23 '15 23:10 tjsavage