Closed Bug 1631436 Opened 5 years ago Closed 4 years ago

Expose CSSStyleSheet post-fetching

Categories

(Core :: DOM: CSS Object Model, defect, P3)

defect

Tracking

()

RESOLVED FIXED
Tracking Status
firefox84 --- fixed

People

(Reporter: annevk, Unassigned)

References

Details

Attachments

(1 file)

Making <link>.sheet non-null in the task where the load event is dispatched is a better model than making it always non-null and exposing cssRules during the load event. It's also what Chrome/Safari do, modulo https://bugs.webkit.org/show_bug.cgi?id=177847 (data URLs).

Arguably this is also what the HTML Standard in combination with CSSOM require, though there is a lot of vagueness between them as well that at some point needs to be sorted.

Flags: needinfo?(emilio)
Priority: -- → P3
Severity: -- → S3

So, WebKit's behavior:

  • Only exposes sheet on link after load (of that stylesheet at least).
  • Exposes sheet of <style> unconditionally, even if there are pending @import loads...

So Firefox behavior is consistent, at least...

Flags: needinfo?(emilio)

I think the inconsistency is not shown by that test, but is by a theoretical other where the <link> style sheet also has an @import as that blocks creation of the style sheet object, whereas for <style> it does not (that's always synchronous).

Even so, in the <style> case WebKit does not create a style sheet object for the imported style sheet until it is fetched.

You could argue that there's a consistency in how WebKit deals with asynchronous style sheet object creation and synchronous style sheet object creation and that we should maybe never have had synchronous style sheet object creation, though I guess https://github.com/WICG/construct-stylesheets/ landed in the other camp. We should get this tested as part of that too.

Bug 1673885 fixed this.

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: