Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(parse): Throw error when attribute selector has spaces after attr…
…ibute modifier
  • Loading branch information
Semigradsky committed Jan 9, 2021
commit 8ec9711bfe1175a134619181eb5df4f8c76b87ee
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