Skip to content
This repository has been archived by the owner on Oct 7, 2020. It is now read-only.

Element constructor produces incorrect is attribute and doesn't call attachedCallback in Firefox #22

Closed
rconnamacher opened this issue May 22, 2015 · 4 comments
Labels

Comments

@rconnamacher
Copy link

Creating elements by constructor incorrectly produces an is attribute and doesn't call attachedCallback in Firefox. (It works correctly in Safari, and I didn't test IE.)

var ctor = document.registerElement("my-element", {});
new ctor();

produces <my-element></my-element> in Safari, but <my element is="false"></my-element> in Firefox. After some digging, this is because the constructor returned by document.registerElement calls document.createElement("my-element", false) in Firefox, and that false argument is then stringified into the is attribute.

More seriously, the bad is attribute causes attachedCallback to never fire.

Tested in document-register-element 4.0 and Firefox 37-38. (I checked the tests, and there don't appear to be any unit tests covering constructors or attachedCallback.)

@rconnamacher rconnamacher changed the title Element constructor broken in Firefox: attachedCallback never fires due to bad is attribute Element constructor broken in Firefox: attachedCallback never fires May 22, 2015
@rconnamacher rconnamacher changed the title Element constructor broken in Firefox: attachedCallback never fires Element constructor produces incorrect is attribute and doesn't call attachedCallback in Firefox May 22, 2015
@WebReflection
Copy link
Owner

I cannot reproduce this on platforms that use this polyfill ... are you sure that's not rather a Firefox bug?

What you are doing is tested all over here: http://webreflection.github.io/document-register-element/test/

plus you are creating an element without any prototype, which attribute/attached should fire?

I need an exact test case to move on, the one you provided is already tested and AFAICT no browser add is attribute as false anywhere.

@WebReflection
Copy link
Owner

actually ... never mind, I can reproduce indeed in firefox ... WTF, I'll fix it asap

@WebReflection
Copy link
Owner

fixed on 0.4.1, apologies for any inconvenience

@rconnamacher
Copy link
Author

Thanks for the speedy fix, it's working here now too.

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

No branches or pull requests

2 participants