@@ -265,82 +265,42 @@ Processing Stylesheet Imports</h3>
265
265
<div algorithm>
266
266
To <dfn export>fetch an @import</dfn> , given an ''@import'' rule |rule|:
267
267
268
+ 1. Let |parentStylesheet| be |rule|'s <a spec=cssom for=CSSRule>parent CSS style sheet</a> .
269
+ [[CSSOM]]
270
+
268
271
1. If |rule| has a <<supports-condition>> ,
269
272
and that condition is not true,
270
- return nothing.
271
-
272
- 1. [=Parse a URL=] given |rule|'s URL,
273
- relative to |rule|'s [=CSSRule/parent CSS style sheet' s=] [=CSSStyleSheet/location=] .
274
-
275
- Issue: Make sure this is defined correctly,
276
- drawing from the document when it's a <{style}> element, etc.
277
-
278
- If that fails, then return nothing. Otherwise, let |url| be the [=resulting URL record=] .
279
-
280
- 2. Let |request| be a new [=/request=]
281
- whose [=request/URL=] is |url|,
282
- [=request/destination=] is <code> "style"</code> ,
283
- [=request/mode=] is <code> "no-cors"</code> ,
284
- [=request/credentials mode=] is <code> "include"</code> ,
285
- and whose [=request/use-URL-credentials flag=] is set.
286
-
287
- 3. Set |request|'s client to ????
288
-
289
- Issue: The Fetch spec doesn't provide any information about what a client is
290
- or what it does,
291
- so I have no idea of what to provide here.
292
-
293
- 4. Run the following steps [=in parallel=] :
273
+ return.
294
274
295
- 1. Let |response| be the result of [=/fetching=] |request|.
275
+ 1. Let |parsedUrl| be the result of the [=URL parser=] steps with |relativeUrl| and
276
+ |parentStylesheet|'s <a spec=cssom>location</a> . If the algorithm returns an error,
277
+ return. [[CSSOM]]
296
278
297
- 2. Let |success| initially be true.
279
+ 1. [=Fetch a style resource=] |parsedUrl|, with |parentStylesheet|, "style", "no-cors",
280
+ and the following steps given [=/response=] |response|:
298
281
299
- 3. If |response| is a [=network error=]
300
- or its [=response/status=] is not an [=ok status=] ,
301
- set |success| to false.
282
+ 1. If |response| is a [=network error=] or its [=response/status=] is not an
283
+ [=ok status=] , return.
302
284
303
- 4 . If |rule|'s [=CSSRule/parent style sheet=] is in [=quirks mode=]
285
+ 1 . If |parentStylesheet| is in [=quirks mode=]
304
286
and |response| is [=CORS-same-origin=] ,
305
287
let |content type| be <code> "text/css"</code> .
306
288
Otherwise, let |content type| be the Content Type metadata of |response|.
307
289
308
- 5 . If |content type| is not <code> "text/css"</code> ,
290
+ 1 . If |content type| is not <code> "text/css"</code> ,
309
291
return.
310
292
311
- 6. Issue: Do we wait for sub-imports to run now?
312
- Need to explore this .
293
+ 1. Let |importedStylesheet| be the result of [=Parse a stylesheet|parsing=] |response|'s
294
+ [=response/body=] 's [=body/stream=] given |parsedUrl| .
313
295
314
- 7. Let |global| be the result of [=finding the relevant global object for a stylesheet=]
315
- given |rule |'s [=CSSRule/parent CSS style sheet=] .
296
+ 1. Set |importedStylesheet|'s <a spec=cssom>origin-clean flag</a> to
297
+ |parentStylesheet |'s <a spec=cssom>origin-clean flag</a> .
316
298
317
- 8. [=Queue a global task=] ,
318
- given the [=networking task source=]
319
- and |global|,
320
- to [=process an imported stylesheet=]
321
- given |rule|,
322
- |success|,
323
- and |response|.
324
- </div>
325
-
326
- <div algorithm>
327
- To <dfn export>find the relevant global object for a stylesheet</dfn> given a CSS style sheet |stylesheet|:
328
-
329
- 1. If |stylesheet| has a [=CSSStyleSheet/parent CSS style sheet=] ,
330
- return the result of [=finding the relevant global object for a stylesheet=]
331
- given the [=CSSStyleSheet/parent CSS style sheet=] .
332
-
333
- 2. If |stylesheet| has an [=CSSStyleSheet/owner node=] ,
334
- return the [=CSSStyleSheet/owner node's=] [=relevant global object=] .
335
- </div>
336
-
337
- <div algorithm>
338
- To <dfn export>process an imported stylesheet</dfn>
339
- given a parent rule |rule|,
340
- a success flag |success|,
341
- and a response |response|:
299
+ 1. If |response|'s [=response/url=]' s [=url/origin=] is not the [=same origin=] as
300
+ |rule|'s [=relevant settings object=]' s [=environment settings object/origin=] ,
301
+ unset |importedStylesheet|'s <a spec=cssom>origin-clean flag</a> .
342
302
343
- Issue: Create a stylesheet, assign it to the parent rule .
303
+ 1. Set |rule|'s {{CSSImportRule/styleSheet}} to |importedStylesheet| .
344
304
</div>
345
305
346
306
<h3 id='content-type'>
0 commit comments