devpunks / snuggsi

snuggsi ツ - Easy Custom Elements in ~1kB
https://snuggsi.com
MIT License
395 stars 17 forks source link

Documentation on polyfill load order is unclear #138

Closed robcole closed 6 years ago

robcole commented 6 years ago

Docs state:

Place the <script name=polyfill … > below before snuggsiツ for evergreen cross-browser support.

Code example shows:

<!-- snuggsiツ (modern) -->
<script nomodule src=//unpkg.com/snuggsi></script>

<!-- webcomponents polyfill -->
<script
  name=polyfill
  src=//cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/1.0.0/webcomponents-hi-ce.js>
</script>

I think the "before below snuggsi" is unclear and causing confusion (at least for me) here. I'd assume the polyfill would be loaded first, but the code example seems to show it in loading last. Thoughts on a change here?

brandondees commented 6 years ago

I was confused in the same way. I think it should read:

Place the polyfill script tag before snuggsi, as shown below

and then actually show it loading before.

I'd have to double check to make sure that it works that way and whether it breaks in the reverse order.

snuggs commented 6 years ago

Actually order is irrelevant @robcole @brandondees. We run zero code until the author calls the Element tagged template helper.

Element `foo-bar` (...)

So i found out order is superfluous. Was a pleasant surprise too.

That being said...what should the text say then?

robcole commented 6 years ago

@snuggs Load order appears to be exhibiting different behaviors in Edge, perhaps IE11 as well (doing some cross browser testing currently)

Happy to draft up some text once I'm 💯 confident in the behavior in multiple browsers, but at the very least I'm seeing differences in error logs based on when the polyfill is loaded. Still digging into ways to get the polyfill itself loaded for now, just to move on to the next phase of debugging this.


Polyfill Loaded First

(no snuggsi errors, only polyfill errors) image

Polyfill Loaded Second

image

snuggs commented 6 years ago

... And I say ... Let's call the whole thing off @robcole ;-) /cc @brandondees #143

snuggs commented 6 years ago

Fixed. https://github.com/devpunks/snuggsi#easy-installation

capture d ecran 2017-09-14 a 09 40 25