Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Error during initialization when children contain a comment node #274

Open
5 tasks
tedplumtree opened this issue May 30, 2018 · 1 comment
Open
5 tasks

Comments

@tedplumtree
Copy link

tedplumtree commented May 30, 2018

Description

I have a use case where I want my element's light DOM to be the children of the iron-form, i.e., the template looks like:

<iron-form>
  <form>
    <slot></slot>
  </form>
</iron-form>

Expected outcome

iron-form's #initializeValues succeeds normally in all cases

Actual outcome

When the light DOM contains an XML comment, i.e, if the node is a comment node, calling the legacy DOM API Polymer.dom blows up. I think it's the same issue as this one

I get an error saying that this.node[method] is undefined

in Polymer DOM's following line:

function forwardMethods(proto, methods) { ....

proto[method] = /** @this {DomApi} */ function() {
  return this.node[method].apply(this.node, arguments);
}
.....

Seems like to be the fix is as easy as checking that the method exists before calling it, or checking that this.node.tagName !== '#comment'. I know that the DOM API is deprecated, but could someone fix this low-hanging fruit?

Live Demo

Will provide if needed

Steps to reproduce

Will provide if needed

Browsers Affected

  • Chrome
  • [X ] Firefox
  • Safari 9
  • Safari 8
  • Safari 7
  • [X ] Edge
  • [X ] IE 11
  • IE 10
@DoktorDaveJoos
Copy link

same

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants