devpunks / snuggsi

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

Determine if <script>s run inside an importable component #116

Closed snuggs closed 7 years ago

snuggs commented 7 years ago

@brandondees please see the following comment https://github.com/devpunks/snuggsi/pull/109#issuecomment-316996698.

And here is the spec definition https://html.spec.whatwg.org/multipage/scripting.html#the-script-element:dom-document-write-2

In response to a discussion being had https://github.com/whatwg/html/issues/2791#issuecomment-316995586

brandondees commented 7 years ago

do you mean INCLUDE not IMPORT?

with import, I don't know.

with include, I believe we should as often as possible treat the "inlined" content as exactly as possible to how it would behave as if it were there in the document to begin with. meaning, scripts block and execute, imports and stylesheets load, etc. -- to the author, this should be as simple as extracting a shared partial between pages with no unexpected side effects or learning curve.

snuggs commented 7 years ago

both one in the same implementation @brandondees except one doesn't require there being an custom element in markup.

snuggs commented 7 years ago

The do @brandondees