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
Can I get a layperson's definition of :defined and what it's used for? :)
Wrt :heading(), we've gotten requests for this an declined them so far. If it's something we want to add, we can add it to Selectors--it's definitely not an HTML-specific concept, so it should go into Selectors and not HTML.
:defined matches all elements that had no problem during construction, roughly. It's useful since you can now implement your own element class and sometimes you want to match elements for which the constructor has not yet run (or vice versa).
As for headings, that sounds reasonable, though we'll run into the data model issue again (though arguably we do already for other things, so it doesn't necessarily add to the problem).
The CSS Working Group just discussed :defined, and agreed to the following:
RESOLVED: Add :defined to selectors L4
The full IRC log of that discussion
<dael> Topic: :defined
<dael> github: https://github.com//issues/2258
<dael> fantasai: HTML defines :defined pseudo class in its spec, in general we define in selectors and HTML refines. So should :defined be defined in selectors?
<dael> fantasai: Matches all elements that had no problem during constructions
<dael> Rossen: Any reason why it shouldn't be defined in selectors?
<dael> fantasai: Very HTML specific currently. That's the only reason I can think of
<dael> Rossen: Not crazy about the name, it's a little too generic
<dael> florian: Would fail to match on custom elements not defined properly and any element whose semantics are unknown to browser?
<dael> fantasai: Don't know
<dael> florian: Reading example that seems to be the case. If using on a not known element it won't match.
<dael> florian: Does make it non-HTML specific even if use cases are HTML specific
<dael> florian: Seems like we should do this, but also study more
<dael> fantasai: It's impl afaict
<dael> Rossen: Impl in blink?
<dael> fantasai: Not registering as invalid in test case.
<dael> emilio: Impl in blink, gecko, and webkit
<fantasai> http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0A%3Cstyle%3E%0Ahtml%3Adefined%2C%20foo%3Adefined%20%7B%20border%3A%20solid%20green%3B%20%7D%0A%3C%2Fstyle%3E%0A%3Cfoo%3EThis%20is%20a%20test%3C%2Ffoo%3E
<tantek> are there tests for this?
<dael> Rossen: If this has impl in various UA and since it's a selector makes sense as part of selectors unless we're against it in the way it's defined. We should accept it and refine
<dael> florian: Sounds good
<dael> Rossen: Other comments or Objections to adding :defined to selectors L4?
<dael> RESOLVED: Add :defined to selectors L4
Activity
fantasai commentedon Feb 2, 2018
Can I get a layperson's definition of :defined and what it's used for? :)
Wrt :heading(), we've gotten requests for this an declined them so far. If it's something we want to add, we can add it to Selectors--it's definitely not an HTML-specific concept, so it should go into Selectors and not HTML.
annevk commentedon Feb 3, 2018
:definedmatches all elements that had no problem during construction, roughly. It's useful since you can now implement your own element class and sometimes you want to match elements for which the constructor has not yet run (or vice versa).As for headings, that sounds reasonable, though we'll run into the data model issue again (though arguably we do already for other things, so it doesn't necessarily add to the problem).
snuggs commentedon Mar 15, 2018
To embellish on @annevk's statement with an example.
If a user wanted to preserve real estate but not display until element is
defined.@annevk does this help or hurt?
css-meeting-bot commentedon Nov 21, 2018
The CSS Working Group just discussed
:defined, and agreed to the following:RESOLVED: Add :defined to selectors L4The full IRC log of that discussion
<dael> Topic: :defined<dael> github: https://github.com//issues/2258
<dael> fantasai: HTML defines :defined pseudo class in its spec, in general we define in selectors and HTML refines. So should :defined be defined in selectors?
<dael> fantasai: Matches all elements that had no problem during constructions
<dael> Rossen: Any reason why it shouldn't be defined in selectors?
<dael> fantasai: Very HTML specific currently. That's the only reason I can think of
<dael> Rossen: Not crazy about the name, it's a little too generic
<dael> florian: Would fail to match on custom elements not defined properly and any element whose semantics are unknown to browser?
<dael> fantasai: Don't know
<dael> florian: Reading example that seems to be the case. If using on a not known element it won't match.
<dael> florian: Does make it non-HTML specific even if use cases are HTML specific
<dael> florian: Seems like we should do this, but also study more
<dael> fantasai: It's impl afaict
<dael> Rossen: Impl in blink?
<dael> fantasai: Not registering as invalid in test case.
<dael> emilio: Impl in blink, gecko, and webkit
<fantasai> http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0A%3Cstyle%3E%0Ahtml%3Adefined%2C%20foo%3Adefined%20%7B%20border%3A%20solid%20green%3B%20%7D%0A%3C%2Fstyle%3E%0A%3Cfoo%3EThis%20is%20a%20test%3C%2Ffoo%3E
<tantek> are there tests for this?
<dael> Rossen: If this has impl in various UA and since it's a selector makes sense as part of selectors unless we're against it in the way it's defined. We should accept it and refine
<dael> florian: Sounds good
<dael> Rossen: Other comments or Objections to adding :defined to selectors L4?
<dael> RESOLVED: Add :defined to selectors L4
[selectors] :defined CSS selector
Bug 1509338 [wpt PR 14184] - [selectors] :defined CSS selector, a=tes…
Bug 1509338 [wpt PR 14184] - [selectors] :defined CSS selector, a=tes…
Bug 1509338 [wpt PR 14184] - [selectors] :defined CSS selector, a=tes…
Bug 1509338 [wpt PR 14184] - [selectors] :defined CSS selector, a=tes…
snuggs commentedon Dec 13, 2018
@annevk @fantasai is this good to close now that is on track with CSS Level4?
annevk commentedon Dec 13, 2018
I think it would make sense to close this when the PR that adds this to Selectors Level 4 lands.
2 remaining items
Meta: stop exporting pseudo-classes
Meta: stop exporting pseudo-classes
Remove :defined pseudo-class
Remove :defined pseudo-class
Bug 1509338 [wpt PR 14184] - [selectors] :defined CSS selector, a=tes…
Bug 1509338 [wpt PR 14184] - [selectors] :defined CSS selector, a=tes…
Bug 1509338 [wpt PR 14184] - [selectors] :defined CSS selector, a=tes…
Bug 1509338 [wpt PR 14184] - [selectors] :defined CSS selector, a=tes…
Bug 1509338 [wpt PR 14184] - [selectors] :defined CSS selector, a=tes…
Bug 1509338 [wpt PR 14184] - [selectors] :defined CSS selector, a=tes…
Remove :defined pseudo-class
hober commentedon Apr 21, 2021
As #3735 landed a while ago, can we close this issue now?
Bug 1509338 [wpt PR 14184] - [selectors] :defined CSS selector, a=tes…
Bug 1509338 [wpt PR 14184] - [selectors] :defined CSS selector, a=tes…