Commit a7f9bbe
committed
Add support for parsing a byte stream and fetching @import style sheet
Adding support for one depends on adding support for the other, since parsing a
byte stream requires looking up an encoding in HTTP headers.
The implementation of "fetch a style resource" uses fetch() from undici, which
uses the same "fetch" algorithm but:
- it does not make the response opaque for the user (which is is needed here)
- it does not check CORS headers (which has been implemented)
- it does not set credentials (which will be implemented in a future commit)
fetch() can do everything that an implementation with get() or request() from
node can do. None can set the request initiator reported to the Performance API,
nor the use-URL-credentials flag to authenticate with credentials in the URL,
which could be circumvented later.
Adding the style sheet to document.styleSheets, aborting fetch() when the rule
is discarded by the parser, fetching the style sheet when its media condition
becomes true, setting document.cookies with entries defined in the response,
also have been postponed.
This implementation has multiple deviations from the specifications, which will
remain undocumented since "fetch a style resource" and "fetch @import style
sheet" are objectively more drafts than carefully reviewed algorithms.
This commit also includes minor changes not directly related.1 parent 5b2a9f7 commit a7f9bbe
File tree
25 files changed
+925
-91
lines changed- __tests__
- imported
- css
- lib
- cssom
- parse
- utils
- values
- scripts
25 files changed
+925
-91
lines changedBinary file not shown.
Binary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
0 commit comments