Skip to content

Commit dc51092

Browse files
RyuuGanfb55
authored andcommitted
fix(css-selectors): extend regex to include superscript in range, fix #27 (#28)
1 parent a5f1991 commit dc51092

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
module.exports = parse;
44

5-
var re_name = /^(?:\\.|[\w\-\u00c0-\uFFFF])+/,
5+
var re_name = /^(?:\\.|[\w\-\u00b0-\uFFFF])+/,
66
re_escape = /\\([\da-f]{1,6}\s?|(\s)|.)/ig,
77
//modified version of https://github.com/jquery/sizzle/blob/master/src/sizzle.js#L87
8-
re_attr = /^\s*((?:\\.|[\w\u00c0-\uFFFF\-])+)\s*(?:(\S?)=\s*(?:(['"])([^]*?)\3|(#?(?:\\.|[\w\u00c0-\uFFFF\-])*)|)|)\s*(i)?\]/;
8+
re_attr = /^\s*((?:\\.|[\w\u00b0-\uFFFF\-])+)\s*(?:(\S?)=\s*(?:(['"])([^]*?)\3|(#?(?:\\.|[\w\u00b0-\uFFFF\-])*)|)|)\s*(i)?\]/;
99

1010
var actionTypes = {
1111
__proto__: null,

tests/test.js

+15
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,21 @@ var tests = [
162162
],
163163
"Space after escaped space"
164164
],
165+
[
166+
".m™²³",
167+
[
168+
[
169+
{
170+
type: "attribute",
171+
name: "class",
172+
action: "element",
173+
value: "m™²³",
174+
ignoreCase: false
175+
}
176+
]
177+
],
178+
"Special charecters in selector"
179+
],
165180
[
166181
"\\61 ",
167182
[

0 commit comments

Comments
 (0)