-
Notifications
You must be signed in to change notification settings - Fork 184
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
adding matches pseudo-class #186
Conversation
css/selectors.json
Outdated
@@ -272,6 +272,14 @@ | |||
], | |||
"status": "standard" | |||
}, | |||
":matches()": { | |||
"syntax": ":matches( selector[, selector]* )", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
selector[, selector]*
-> <selector>#
However, it takes a <selector-list>
(https://www.w3.org/TR/selectors-4/#matches), but this syntax is not defined yet. Grammar can be taken here: https://www.w3.org/TR/selectors-4/#grammar
@lahmatiy So, I tried adding the necessary syntax definitions. That was a serious rabbit hole to fall down ;-) I took all the syntax definitions straight from the spec, except for:
These are just described and not actually shown, so I'm not 100% sure if I've got these right. |
css/selectors.json
Outdated
@@ -272,6 +272,14 @@ | |||
], | |||
"status": "standard" | |||
}, | |||
":matches()": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be :matches
.
@@ -233,6 +260,9 @@ | |||
"frequency-percentage": { | |||
"syntax": "<frequency> | <percentage>" | |||
}, | |||
"function-token": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function-token
is a token type and out of scope of this dict.
Btw, it has another syntax
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I should remove these then...? How should this be represented then in our data? Some kind of link to the spec definition of token types?
The syntax definition I included was basically a guess based on my knowledge of related syntax, but I didn't really know what I was doing.
Same comment for the other token types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those tokens are defined in CSS Syntax Module Level 3 and shouldn't be presented in syntax.json
. Because they are something like a generic, as <string>
or <number>
but a bit low-level.
@@ -254,6 +284,9 @@ | |||
"grid-line": { | |||
"syntax": "auto | <custom-ident> | [ <integer> && <custom-ident>? ] | [ span && [ <integer> || <custom-ident> ] ]" | |||
}, | |||
"hash-token": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hash-token
is a token type and out of scope of this dict.
Btw, it has another syntax
"id-selector": { | ||
"syntax": "<hash-token>" | ||
}, | ||
"ident-token": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ident-token
is a token type and out of scope of this dict.
Btw, it has another syntax
@@ -716,6 +767,12 @@ | |||
"step-timing-function": { | |||
"syntax": "step-start | step-end | steps(<integer>[, [ start | end ] ]?)" | |||
}, | |||
"string-token": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string-token
is a token type and out of scope of this dict.
Btw, it has another syntax
@@ -11,12 +11,24 @@ | |||
"animateable-feature": { | |||
"syntax": "scroll-position | contents | <custom-ident>" | |||
}, | |||
"any-value": { | |||
"syntax": "[!]+" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know what means such syntax. Could you explain?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh, I was guessing what it should possibly be, based on reading this defintion https://drafts.csswg.org/css-syntax-3/#typedef-any-value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, well, that' diffidently incorrect. [!]+
means one or more exclamation marks and nothing else ;)
<any-value>
can't be represented with such syntax, since it means any valid CSS value. Actually it's a generic and should be excluded from syntax.json
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you again ;-)
I have opened up a separate issue to track this: #190
@@ -11,12 +11,24 @@ | |||
"animateable-feature": { | |||
"syntax": "scroll-position | contents | <custom-ident>" | |||
}, | |||
"any-value": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it's a generic that out of scope of this dict
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Thanks for your continued help.
@teoli2003 can I get your advice on how we can make progress on this one? |
@lahmatiy if we remove all you listed above, would it be ready to go? |
This needs rebasing |
I got fed up with waiting and opened #284. |
I'm really glad you did — you've actually come up with a really simple solution to this, whereas my attempt was horribly overcomplicated and we got stalled on it. |
As per https://bugzilla.mozilla.org/show_bug.cgi?id=1440868