Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-conditional-3] define whether/how it matters if namespace prefixes are declared #3220

Closed
dbaron opened this issue Oct 17, 2018 · 9 comments

Comments

@dbaron
Copy link
Member

dbaron commented Oct 17, 2018

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)?
@dbaron
Copy link
Member Author

dbaron commented Oct 17, 2018

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.

@emilio
Copy link
Collaborator

emilio commented 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 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.

@emilio
Copy link
Collaborator

emilio commented Oct 17, 2018

(Do the same as in "treat it as invalid", not as in throwing :))

@dbaron
Copy link
Member Author

dbaron commented 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
Copy link
Collaborator

Minutes of the earlier discussion: https://lists.w3.org/Archives/Public/www-style/2018Dec/0004.html

@svgeesus
Copy link
Contributor

svgeesus commented Oct 1, 2020

RESOLVED: Namespaces are either always valid or valid when they're declared. (Issue #3220)

Well, we need to pick one of those :)

@svgeesus
Copy link
Contributor

svgeesus commented Oct 1, 2020

@emilio, any opinions?

@emilio
Copy link
Collaborator

emilio commented Oct 22, 2020

I'd prefer the "valid when declared" option. Still less special-casey.

@css-meeting-bot
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants