DOMContentLoaded and older browsers

125 views
Skip to first unread message

Julien Eluard

unread,
Apr 2, 2014, 10:33:46 PM4/2/14
to polym...@googlegroups.com
Hi,

it looks like DOMContentLoaded is not fired when polymer's platform.js is used (v0.2.2). When removing it the event is correctly fired.
I noticed this at least on Firefox #20.

Is this behavior expected for non-supported browser (assuming Firefox 20 is not supported)? 

Thanks,
Julien

Eric Bidelman

unread,
Apr 3, 2014, 12:41:43 AM4/3/14
to Julien Eluard, polymer-dev
Polymer only supports the latest version of every browser and the current version of Firefox is 28. I just verified polymer-project.org on FF 28 and DOMContentLoaded was fired correctly :)


Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/1ad9ac73-30f1-4774-b3a5-3e2705cc1711%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Julien Eluard

unread,
Apr 3, 2014, 8:45:59 AM4/3/14
to polym...@googlegroups.com, Julien Eluard
Right, I have no problem with latest Firefox.

I understand polymer's polyfills only work with evergreen browser, ans that's fine.
Now I was assuming on older browser Web Components would not work but that polymer would not interact with others browser features. This would allow to build website that could gracefully degrade and still use polymer.
Now if such basic feature as DOMContentLoaded cannot be relied on it makes such task pretty hard.

Is the assumption that you should only use polymer for website that will strictly be used with evergreen browsers?

Thanks,
Julien

Eric Bidelman

unread,
Apr 3, 2014, 12:31:19 PM4/3/14
to Julien Eluard, polymer-dev
On Thu, Apr 3, 2014 at 5:45 AM, Julien Eluard <julien...@gmail.com> wrote:
Right, I have no problem with latest Firefox.

I understand polymer's polyfills only work with evergreen browser, ans that's fine.
Now I was assuming on older browser Web Components would not work but that polymer would not interact with others browser features. This would allow to build website that could gracefully degrade and still use polymer.
Now if such basic feature as DOMContentLoaded cannot be relied on it makes such task pretty hard.

A hard requirement of loading platform.js is that it comes before any other code that touches the DOM. This is due to the Shadow DOM polyfill. It's invasive in that it wraps all DOM nodes to shim the encapsulation features the native API provides. Older browsers can throw a fit when this happens.

What platform.js provides is the entire package and a few extra goodies. However, you may have luck if you're interested in using parts of the web components family (e.g. just the custom elements polyfill, just the HTML Imports polyfill). Each polyfill is useful and can be built standalone. 

B
 

Is the assumption that you should only use polymer for website that will strictly be used with evergreen browsers?

I won't tell you that :) but you should tread with caution in unsupported browsers.


Thanks,
Julien

Le jeudi 3 avril 2014 01:41:43 UTC-3, Eric Bidelman a écrit :
Polymer only supports the latest version of every browser and the current version of Firefox is 28. I just verified polymer-project.org on FF 28 and DOMContentLoaded was fired correctly :)


On Wed, Apr 2, 2014 at 7:33 PM, Julien Eluard <julien...@gmail.com> wrote:
Hi,

it looks like DOMContentLoaded is not fired when polymer's platform.js is used (v0.2.2). When removing it the event is correctly fired.
I noticed this at least on Firefox #20.

Is this behavior expected for non-supported browser (assuming Firefox 20 is not supported)? 

Thanks,
Julien

Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev...@googlegroups.com.

Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev...@googlegroups.com.

Julien Eluard

unread,
Apr 3, 2014, 12:52:19 PM4/3/14
to Eric Bidelman, polymer-dev
>However, you may have luck if you're interested in using parts of the web components family (e.g. just the custom elements polyfill, just the HTML Imports polyfill). Each polyfill is useful and can be built standalone. 

Great I will probably do that then. I mostly interested with the CustomElements polyfill. Any hint on how to build the full custom-elements.js polyfill would be appreciated, I can't find it on bower and it doesn't look that easy to build.

Thanks!
Julien

Eric Bidelman

unread,
Apr 3, 2014, 1:56:36 PM4/3/14
to Julien Eluard, polymer-dev

Building each polyfill is not as easy as it used to be. We have an open issue to get the process documented. Until then, I was able to build the CE polyfill by running:

mkdir cepolyfill; cd cepolyfill

git clone https://github.com/polymer/MutationObservers

git clone https://github.com/polymer/tools

git clone https://github.com/polymer/CustomElements

cd CustomElements

npm install

grunt

Grunt will produce: custom-elements.min.js in the cepolyfill directory.


Hope this helps,

Eric


Julien Eluard

unread,
Apr 3, 2014, 3:16:46 PM4/3/14
to Eric Bidelman, polymer-dev
Awesome, it works perfect! Thanks Eric for the help!

I just had to add:
so that no error is generated on Chrome (ironically it's not needed for Firefox).

I now have CustomElements correctly polyfilled in Firefox 20.

Julien


You received this message because you are subscribed to a topic in the Google Groups "Polymer" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/polymer-dev/4mR3_aQWYP0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to polymer-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/CACGqRCBU5ZXMEh8r-jQfkw8z0_oQ4SZaSUKeGa67b2xLMhHbxg%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages