You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[css-conditional-3] define whether/how it matters if namespace prefixes are declared #3220
One issue that came up in #3207 (noticed by @heycam while reviewing code from @emilio) is that the spec should define to what extent namespace prefixes are required to be declared. In particular, how do:
@supports (content:attr(n|href)) {
}
CSS.supports("content","attr(n|href)");
CSS.supports("(content: attr(n|href))");
depend on whether the namespace prefix n has been declared? Do they:
treat all namespace prefixes as already declared?
treat all namespace prefixes as undeclared (invalid)?
depend on a set of namespace declarations (which set, exactly)?
And I'd note that one of the relevant pieces here is that the CSS Qualified Names section of namespaces says:
CSS qualified names can be used in (for example) selectors and property values as described in other modules. Those modules must define handling of namespace prefixes that have not been properly declared. Such handling should treat undeclared namespace prefixes as a parsing error that will cause the selector or declaration (etc.) to be considered invalid and, in CSS, ignored.
Thanks for filing, was on my list of things to do :)
As I said in the linked issue, I'd argue for keeping the consistency with existing APIs in regards of treating undeclared namespaces as invalid.
For example, right now document.querySelector("a|b") throws instead of returning null, for example. I think CSS.supports should do the same, and same @supports unless namespaces are registered in the style sheet.
This is both more consistent (IMO) and easier to implement / less special-casey.
In the discussion just minuted in #3207, we resolved not to take the option of "namespaces are all invalid", but didn't yet choose between "all valid" and "use the namespace map".
The CSS Working Group just discussed define whether/how it matters if namespace prefixes are declared, and agreed to the following:
RESOLVED: the CSS.supports() function considers all namespaces invalid (like .querySelector() does), the @supports rule consults the stylesheet's namespace map
The full IRC log of that discussion
<gregwhitworth> Topic: define whether/how it matters if namespace prefixes are declared
<astearns> github: https://github.com//issues/3220
<TabAtkins> @supports (content: attr(n|href)) {
<TabAtkins> }
<gregwhitworth> TabAtkins: things that take a namespace value, such as the attr function
<gregwhitworth> TabAtkins: in this case if the n namespace is not declared should this supports declaration valid or not
<gregwhitworth> TabAtkins: emilio_ had an opinion 14 mins ago
<gregwhitworth> TabAtkins: only consider it valid when the namespace has been declared
<gregwhitworth> TabAtkins: I don't like namespaces so I don't care
<chris> ok someone else take this, I will rejoin
<TabAtkins> document.querySelector("a|b")
<gregwhitworth> TabAtkins: emilio_ also pointed out ^ (example) does check the namespace map
<fantasai> chris points out it's a corner case
<gregwhitworth> TabAtkins: thus we should probably stay consistent with APIs that care about namepaces
<gregwhitworth> TabAtkins: it shouldn't matter, as chris said it's a corner case
<gregwhitworth> fremy: one thing - you have to re-verify the at-supports
<gregwhitworth> fantasai: no - that's not true, namespaces are per file
<gregwhitworth> fremy: how does that work in queryselector?
<fantasai> https://www.w3.org/TR/css-namespaces/#scope
<gregwhitworth> rune: yeah I don't get how query selector will work
<emilio_> It does _not_ check the ns map, there's no ns map to check
<gregwhitworth> TabAtkins: at-supports should query the stylesheets namespace value
<emilio_> But yeah @supports could
<gregwhitworth> TabAtkins: so, I'm fine with emilio_ opinion
<gregwhitworth> fantasai: I'm in favor of what's easy to implement as well
<TabAtkins> proposed resolution: the CSS.supports() function considers all namespaces invalid (like .querySelector() does), the @supports rule consults the stylesheet's namespace map
<gregwhitworth> chris: I just want it defined
<gregwhitworth> astearns: any objections
<gregwhitworth> the CSS.supports() function considers all namespaces invalid (like .querySelector() does), the @supports rule consults the stylesheet's namespace map
<gregwhitworth> RESOLVED: the CSS.supports() function considers all namespaces invalid (like .querySelector() does), the @supports rule consults the stylesheet's namespace map
Activity
dbaron commentedon Oct 17, 2018
And I'd note that one of the relevant pieces here is that the CSS Qualified Names section of namespaces says:
emilio commentedon Oct 17, 2018
Thanks for filing, was on my list of things to do :)
As I said in the linked issue, I'd argue for keeping the consistency with existing APIs in regards of treating undeclared namespaces as invalid.
For example, right now
document.querySelector("a|b")throws instead of returning null, for example. I thinkCSS.supportsshould do the same, and same@supportsunless namespaces are registered in the style sheet.This is both more consistent (IMO) and easier to implement / less special-casey.
emilio commentedon Oct 17, 2018
(Do the same as in "treat it as invalid", not as in throwing :))
dbaron commentedon Oct 23, 2018
In the discussion just minuted in #3207, we resolved not to take the option of "namespaces are all invalid", but didn't yet choose between "all valid" and "use the namespace map".
fantasai commentedon Sep 18, 2020
Minutes of the earlier discussion: https://lists.w3.org/Archives/Public/www-style/2018Dec/0004.html
svgeesus commentedon Oct 1, 2020
Well, we need to pick one of those :)
svgeesus commentedon Oct 1, 2020
@emilio, any opinions?
emilio commentedon Oct 22, 2020
I'd prefer the "valid when declared" option. Still less special-casey.
css-meeting-bot commentedon Oct 22, 2020
The CSS Working Group just discussed
define whether/how it matters if namespace prefixes are declared, and agreed to the following:RESOLVED: the CSS.supports() function considers all namespaces invalid (like .querySelector() does), the @supports rule consults the stylesheet's namespace mapThe full IRC log of that discussion
<gregwhitworth> Topic: define whether/how it matters if namespace prefixes are declared<astearns> github: https://github.com//issues/3220
<TabAtkins> @supports (content: attr(n|href)) {
<TabAtkins> }
<gregwhitworth> TabAtkins: things that take a namespace value, such as the attr function
<gregwhitworth> TabAtkins: in this case if the n namespace is not declared should this supports declaration valid or not
<gregwhitworth> TabAtkins: emilio_ had an opinion 14 mins ago
<gregwhitworth> TabAtkins: only consider it valid when the namespace has been declared
<gregwhitworth> TabAtkins: I don't like namespaces so I don't care
<chris> ok someone else take this, I will rejoin
<TabAtkins> document.querySelector("a|b")
<gregwhitworth> TabAtkins: emilio_ also pointed out ^ (example) does check the namespace map
<fantasai> chris points out it's a corner case
<gregwhitworth> TabAtkins: thus we should probably stay consistent with APIs that care about namepaces
<gregwhitworth> TabAtkins: it shouldn't matter, as chris said it's a corner case
<gregwhitworth> fremy: one thing - you have to re-verify the at-supports
<gregwhitworth> fantasai: no - that's not true, namespaces are per file
<gregwhitworth> fremy: how does that work in queryselector?
<fantasai> https://www.w3.org/TR/css-namespaces/#scope
<gregwhitworth> rune: yeah I don't get how query selector will work
<emilio_> It does _not_ check the ns map, there's no ns map to check
<gregwhitworth> TabAtkins: at-supports should query the stylesheets namespace value
<emilio_> But yeah @supports could
<gregwhitworth> TabAtkins: so, I'm fine with emilio_ opinion
<gregwhitworth> fantasai: I'm in favor of what's easy to implement as well
<TabAtkins> proposed resolution: the CSS.supports() function considers all namespaces invalid (like .querySelector() does), the @supports rule consults the stylesheet's namespace map
<gregwhitworth> chris: I just want it defined
<gregwhitworth> astearns: any objections
<gregwhitworth> the CSS.supports() function considers all namespaces invalid (like .querySelector() does), the @supports rule consults the stylesheet's namespace map
<gregwhitworth> RESOLVED: the CSS.supports() function considers all namespaces invalid (like .querySelector() does), the @supports rule consults the stylesheet's namespace map
[css-conditional-3] ns in conditional rules must be declared #3220
[css-conditional-3] ns in supports() invalid, #3220
[css-conditional-3] Add @namespace + @supports tests.
[css-conditional-4] Clarify ns prefixes must be declared #3220