Skip to content

Commit b5d6b71

Browse files
authored
Update fragment script explanation in documentation
Clarify the behavior of fragment scripts regarding imports and cloning.
1 parent ad87d49 commit b5d6b71

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

fragment-include-explainer.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Taking from the [HTML modules](https://github.com/WICG/webcomponents/issues/645)
2020
- A fragment script is sanitized (safe mode) by default.
2121
- A fragment script can have an `unsafe` attribute. The `unsafe` attribute can be empty or have a `run-script` value that would make the patch run scripts.
2222
- A fragment script has module semantics, in terms of idempotency. The fragment is a `DocumentFragment` in the module tree, and can be mutated, but is cloned and appended when imported so mutations don't affect past imports.
23+
- The above means that you can also `import fragment from "something.html" { type: "fragment" }` and it would clone a `DocumentFragment` to your JS.
2324
- The `async` and `defer` attributes work the same way as for JS scripts.
2425

2526
## Performance

0 commit comments

Comments
 (0)