PolymerElements / paper-button

A button à la Material Design
https://www.webcomponents.org/element/PolymerElements/paper-button
138 stars 64 forks source link

document.createElement('paper-button') DOMException #144

Closed jaichandra closed 7 years ago

jaichandra commented 7 years ago

Description

With the latest 2.0-preview branch, if I do document.createElement('paper-button');, I am getting a DOMException.

This seems to be caused by the below code in paper-button.

created: function() {
        this.classList.add('paper-material');
      },

Changing that to use connectedCallback seems to fix the issue.

Expected outcome

No Error

Actual outcome

DOMException:

Uncaught DOMException: Failed to construct 'CustomElement': The result must not have attributes
    at <anonymous>:1:10

Live Demo

Steps to reproduce

Browsers Affected

WoodyWoodsta commented 7 years ago

Confirmed. See point five of section 2.2 of the spec.

notwaldorf commented 7 years ago

/cc @cdata

notwaldorf commented 7 years ago

my 2 cents is that changing that to connectedCallback is fine

justincy commented 7 years ago

Changing it to connectedCallback didn't work for me (the error went away but the style's weren't added). I had to change it to attached.

jaichandra commented 7 years ago

@justincy thats correct. I have the PR with attached here #145

notwaldorf commented 7 years ago

Closing, as we're no longer adding the paper-material class on the host