WebKit / standards-positions

WebKit's positions on emerging web specifications
https://webkit.org/standards-positions/
240 stars 18 forks source link

Allow CSSImportRule.styleSheet to be null #325

Open amoseui opened 4 months ago

amoseui commented 4 months ago

WebKittens

No response

Title of the spec

CSS Object Model (CSSOM)

URL to the spec

https://drafts.csswg.org/cssom/#the-cssimportrule-interface

URL to the spec's repository

https://github.com/w3c/csswg-drafts

Issue Tracker URL

No response

Explainer URL

No response

TAG Design Review URL

No response

Mozilla standards-positions issue URL

No response

WebKit Bugzilla URL

No response

Radar URL

No response

Description

CSSImportRule.styleSheet became nullable in https://github.com/w3c/csswg-drafts/pull/8773 from the issue https://github.com/w3c/csswg-drafts/issues/8608. The behavior of @import had not been matched with CSSOM CSSImportRule.

https://drafts.csswg.org/css-cascade-5/#at-import:

Additionally, if a blocks the application of the imported style sheet, the UA must not fetch the style sheet (unless it is loaded through some other link) and must return null for the import rule’s CSSImportRule.styleSheet value (even if it is loaded through some other link).

It was fixed as following.

https://drafts.csswg.org/cssom/#the-cssimportrule-interface

The styleSheet attribute must return the associated CSS style sheet, if any, or null otherwise.

NOTE: An @import at-rule might not have an associated CSS style sheet (e.g., if it has a non-matching supports() condition).

annevk commented 4 months ago

My main worry here would be that the lifetime of these objects is not carefully defined and as such when they return null and non-null can end up varying in edge cases.