Firefox 35 doesn't define Element.prototype.createShadowRoot
createShadowRoot is not defined in Firefox 35 and throws 'originalCreateShadowRoot is undefined'.
https://github.com/webcomponents/webcomponentsjs/blob/0.5.4/webcomponents-lite.js#L1365
hi @pennyfx webcomponents-lite does not include ShadowDOM polyfill, and Firefox does not yet implement ShadowDOM, so this is not expected to work. Use webcomponents.js if you need createShadowRoot. let me know if that works for you. Cheers!
I don't need to use it. The issue is that you guys are not checking to see if createShadowRoot is defined before calling it on line 1367.
https://github.com/webcomponents/webcomponentsjs/blob/0.5.4/webcomponents-lite.js#L1367
Please check to see if Element.prototype.createShadowRoot exists before rewriting it. Otherwise downstream libraries won't be able to feature detect on it.
hi, can you explain who's calling createShadowRoot? you're linking to the var root = ... line:
var originalCreateShadowRoot = Element.prototype.createShadowRoot;
Element.prototype.createShadowRoot = function() {
var root = originalCreateShadowRoot.call(this);
CustomElements.watchShadow(this);
return root;
};
to get there, someone had to call createShadowRoot already. who? a jsbin to illustrate the problem you're seeing would be very helpful. or at least a full stack trace. Thanks!
Ah, I think I get what you're saying. Yeah, the point about feature detection is good. I was confused by Firefox 35 in the bug title, it made it sound like a much more specific problem you were hitting :)
A workaround for feature testing Shadow DOM is window.ShadowRoot.
I'm guessing the fix for this is really simple, but let me double check the ordering when we're in webcomponents.js
ah, I see #174 too, going to dupe this against that one (also taking a look)
fyi, landed the fix. thanks for filing this!
Awesome, thanks.
-----Original Message----- From: "John Messerly" [email protected] Sent: 1/28/2015 8:49 AM To: "webcomponents/webcomponentsjs" [email protected] Cc: "Arron Schaar" [email protected] Subject: Re: [webcomponentsjs] Firefox 35 doesn't defineElement.prototype.createShadowRoot (#173)
fyi, landed the fix. thanks for filing this! — Reply to this email directly or view it on GitHub.=