Skip to content

Commit

Permalink
fix(parse): Allow space after attribute selector modifier (#393)
Browse files Browse the repository at this point in the history
  • Loading branch information
Semigradsky authored Jan 9, 2021
1 parent 7a41152 commit a334fa3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/__fixtures__/out.json
Original file line number Diff line number Diff line change
Expand Up @@ -11430,6 +11430,18 @@
}
]
],
"[ a=b i ]": [
[
{
"type": "attribute",
"namespace": null,
"name": "a",
"action": "equals",
"value": "b",
"ignoreCase": true
}
]
],
"[id*=option1]": [
[
{
Expand Down
2 changes: 1 addition & 1 deletion src/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export type TraversalType =
const reName = /^[^\\#]?(?:\\(?:[\da-f]{1,6}\s?|.)|[\w\-\u00b0-\uFFFF])+/;
const reEscape = /\\([\da-f]{1,6}\s?|(\s)|.)/gi;
// Modified version of https://github.com/jquery/sizzle/blob/master/src/sizzle.js#L87
const reAttr = /^\s*(?:(\*|[-\w]*)\|)?((?:\\.|[\w\u00b0-\uFFFF-])+)\s*(?:(\S?)=\s*(?:(['"])((?:[^\\]|\\[^])*?)\4|(#?(?:\\.|[\w\u00b0-\uFFFF-])*)|)|)\s*([iIsS])?\]/;
const reAttr = /^\s*(?:(\*|[-\w]*)\|)?((?:\\.|[\w\u00b0-\uFFFF-])+)\s*(?:(\S?)=\s*(?:(['"])((?:[^\\]|\\[^])*?)\4|(#?(?:\\.|[\w\u00b0-\uFFFF-])*)|)|)\s*([iIsS])?\s*\]/;

const actionTypes: { [key: string]: AttributeAction } = {
undefined: "exists",
Expand Down

0 comments on commit a334fa3

Please sign in to comment.