W3C home > Mailing lists > Public > public-css-archive@w3.org > March 2020

[csswg-drafts] [css-cascade] Unclear which origins to compare for @import in quirks mode (#4838)

From: Simon Pieters via GitHub <sysbot+gh@w3.org>
Date: Fri, 06 Mar 2020 09:28:32 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-576803909-1583486911-sysbot+gh@w3.org>
zcorpan has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-cascade] Unclear which origins to compare for @import in quirks mode ==
Spec https://drafts.csswg.org/css-cascade/#content-type

> The processing of imported style sheets depends on the actual type of the linked resource. If the resource does not have Content-Type metadata, or the host document is in quirks mode and has the same origin as the imported style sheet, the type of the linked resource is text/css. Otherwise, the type is determined from its Content-Type metadata.
>If the linked resource’s type is text/css, it must be interpreted as a CSS style sheet. Otherwise, it must be interpreted as a network error.

The HTML spec says for `<link rel=stylesheet>`:

> Quirk: If the document has been set to quirks mode, has the same origin as the URL of the external resource, and the Content-Type metadata of the external resource is not a supported style sheet type, the user agent must instead assume it to be text/css.


I said the following on Twitter https://twitter.com/zcorpan/status/1235724741224226816

> Does something say that stylesheets can have an origin? HTML doesn't. https://html.spec.whatwg.org/multipage/origin.html#concept-origin
> Which origins should be compared? The imported URL's origin with the host document's origin? The imported URL's origin with the current stylesheet's URL's? (Before or after redirects?)

Reading the `@import` spec again I think it's clear that it's comparing the host document's origin. But the other origin is less clear, since the origin of "the imported style sheet" is not defined, as far as I know.

(The question about before or after redirects might also apply to HTML.)

cc @tabatkins @annevk

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4838 using your GitHub account
Received on Friday, 6 March 2020 09:28:34 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:42:02 UTC