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

Error during initialization when children contain a comment node #274

@tedplumtree

Description

@tedplumtree

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions