fix(deps): update dependency css-selector-parser to v2 #1759
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
1.4.1
->2.2.3
Release Notes
mdevils/css-selector-parser
v2.2.3
Compare Source
v2.2.2
Compare Source
v2.2.1
Compare Source
v2.2.0
Compare Source
Migrating from 1.x
CssSelectorParser
->createParser
In 1.x versions there was
CssSelectorParser
class which had to be contructed and then configured.In 2.x versions there is
createParser()
function which returns aparse()
function. All the configutation is passedto
createParser()
params.Before:
After:
Predefined CSS syntax definitions
You no longer need to make an extensive configuration of
css-selector-parser
in order to make it understandthe necessary CSS standards. You can now just define CSS/CSS selectors version directly:
Here are the pre-defined CSS standards for your disposal:
css1
: https://www.w3.org/TR/CSS1/css2
: https://www.w3.org/TR/CSS2/css3
/selectors-3
: https://www.w3.org/TR/selectors-3/selectors-4
: https://www.w3.org/TR/selectors-4/latest
: refers toselectors-4
progressive
:latest
+ accepts unknown psudo-classes, psudo-elements and attribute case sensitivity modifiersMake sure you use proper
strict
valueCSS selector parser in modern browsers is very forgiving. For instance, it works fine with unclosed attribute
selectors:
"[attr=value"
. If you would like to mimic this behavior from browsers, setstrict
tofalse
, i.e.:Render is now a separate export
render()
method used to be a method ofCssSelectorParser
class. Now it can be imported directly and used.Example:
AST changes
AST had a lot of changes.
Selector
New type info.
selector
->Selector
.selectors
->rules
, alsoselectors
containedruleSet[]
, which in turn hasrule
field,and new
rules
containsRule[]
directly.Before:
{type: 'selector', selectors: [ {type: 'ruleSet', rule: {<RULE 1 DATA>}}, {type: 'ruleSet', rule: {<RULE 2 DATA>}} ]}
.After:
{type: 'Selector', rules: [ {<RULE 1 DATA>}, {<RULE 2 DATA>} ]}
.Rule
New type info.
rule
->Rule
.id: string
->ids: string[]
. According to the CSS spec one rule may have more than 1id
,so
#root#root
is a valid selector.nestingOperator
->combinator
. A proper name according to CSS spec was chosen.rule
->nestedRule
. A proper name to indicate nesting was chosen.tagName: string
->tag: TagName | WildcardTag
. Using explicit distinction betweenTagName (i.e.
div
) and WildcardTag (*
), because tag name can also be*
if escaped properly (\*
).attrs
->attributes
. Attribute type was changed, see below.pseudos
->pseudoClasses
. There are pseudo-elements and pseudo-classes, now they are separatedproperly (there is a separate
pseudoElement
property). Pseudo class type was changed, see below.Before:
After:
Attribute
New type info.
Attribute
.value
andvalueType
were combined to a single propvalue
with a fieldtype
.All possible value types.
Example 1
Before:
{name: 'role'}
.After:
{type: 'Attribute', name: 'role'}
.Example 2
Before:
{name: 'role', operator: '$=', valueType: 'string', value: 'button'}
.After:
{type: 'Attribute', name: 'role', operator: '$=', value: {type: 'String', value: 'button'}}
.Example 3
Before:
{name: 'role', operator: '=', valueType: 'substitute', value: 'var'}
.After:
{type: 'Attribute', name: 'role', operator: '=', value: {type: 'Substitute', name: 'var'}}
.Pseudo Classes
New type info.
PseudoClass
.value
andvalueType
were combined to a single propargument
with a fieldtype
.All possible argument types.
Example 1
Before:
{name: 'visited'}
.After:
{type: 'PseudoClass', name: 'visited'}
.Example 2
Before:
{name: 'lang', valueType: 'string', value: 'en'}
.After:
{type: 'PseudoClass', name: 'lang', argument: {type: 'String', value: 'en'}}
.Example 3
Before:
{name: 'lang', valueType: 'substitute', value: 'var'}
.After:
{type: 'PseudoClass', name: 'lang', argument: {type: 'Substitute', name: 'var'}}
.Example 4
Before:
{name: 'has', valueType: 'selector', value: {type: 'selector', selectors: [{type: 'ruleSet', rule: {type: 'rule', tagName: 'div'}}]}}
.After:
{type: 'PseudoClass', name: 'has', argument: {type: 'Selector', rules: [{type: 'Rule', tag: {type: 'TagName', name: 'div'}}]}}
.v2.1.0
Compare Source
Configuration
📅 Schedule: Branch creation - "after 10pm,before 5:00am" in timezone America/Vancouver, Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate. View repository job log here.