-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Cannot define an element in the main document (Firefox and Internet explorer) #1187
Comments
From @plequang on June 12, 2015 11:42 I've just seen the sample jsbin mentionned here https://github.com/Polymer/polymer/blob/master/CONTRIBUTING.md#filing-bugs Everything works if I use <script>
HTMLImports.whenReady(function () {
Polymer({
is: 'x-element'
});
});
</script> Maybe it would be worth mentionning this in the documentation ? |
This limitation is documented here: https://www.polymer-project.org/1.0/docs/devguide/registering-elements.html This is, as you guessed, a limitation of the polyfill. Polymer 0.5 worked around this at the cost of additional complexity, so Polymer 1.0 doesn't do the same workaround. This could be clearer in the docs (and we should cover using |
Suggested fix: raise the prominence of this little note by creating a new subhead "Registering elements in the main document" (or words to that effect), and describing the limitation and the workaround. Should note that this workaround is primarily useful for small test cases, since it allows you to keep everything in one file. |
OK my bad. I didn't care enough to little notes while reading the doc. Thanks for your answer. |
Hey @arthurevans . Just wanted to say thank you for highlighting this issue so thoroughly. Saved us a lot of headache/debugging! Cheers. |
Fixed by @kaycebasques in PR #1256. |
From @plequang on June 12, 2015 11:36
While migrating tests from app-router to Polymer 1.0, I've noticed that it is not possible to define an element and use this element in the main document.
The following simple example fails under Firefox and Internet Explorer, because 'Polymer' is not defined :
It works with Chrome though.
Test page is also available here http://plequang.github.io/polymer-tests/
I thought it was a HTMLImport polyfill problem, but the same example with Polymer 0.5 and webcomponentjs 0.7.3 is working correctly.
Is this a bug, or is this way of defining elements prohibited with Polymer 1.0 (meaning you should always define elements in other files than the main document) ?
Thanks
Copied from original issue: Polymer/polymer#1850
The text was updated successfully, but these errors were encountered: