Skip to content

Commit f204a61

Browse files
committed
Tokenization: Remove "#" exception for identifier tokens
1 parent f47ebe4 commit f204a61

File tree

5 files changed

+21
-29
lines changed

5 files changed

+21
-29
lines changed

dist/sizzle.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Released under the MIT license
77
* http://jquery.org/license
88
*
9-
* Date: 2014-04-20
9+
* Date: 2014-04-21
1010
*/
1111
(function( window ) {
1212

@@ -74,25 +74,21 @@ var i,
7474

7575
// Regular expressions
7676

77-
// Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
77+
// http://www.w3.org/TR/css3-selectors/#whitespace
7878
whitespace = "[\\x20\\t\\r\\n\\f]",
79-
// http://www.w3.org/TR/css3-syntax/#characters
80-
characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
8179

82-
// Loosely modeled on CSS identifier characters
83-
// An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
84-
// Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
85-
identifier = characterEncoding.replace( "w", "w#" ),
80+
// http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
81+
identifier = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
8682

8783
// Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
88-
attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace +
84+
attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
8985
// Operator (capture 2)
9086
"*([*^$|!~]?=)" + whitespace +
9187
// "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
9288
"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
9389
"*\\]",
9490

95-
pseudos = ":(" + characterEncoding + ")(?:\\((" +
91+
pseudos = ":(" + identifier + ")(?:\\((" +
9692
// To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
9793
// 1. quoted (capture 3; capture 4 or capture 5)
9894
"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
@@ -114,9 +110,9 @@ var i,
114110
ridentifier = new RegExp( "^" + identifier + "$" ),
115111

116112
matchExpr = {
117-
"ID": new RegExp( "^#(" + characterEncoding + ")" ),
118-
"CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
119-
"TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
113+
"ID": new RegExp( "^#(" + identifier + ")" ),
114+
"CLASS": new RegExp( "^\\.(" + identifier + ")" ),
115+
"TAG": new RegExp( "^(" + identifier + "|[*])" ),
120116
"ATTR": new RegExp( "^" + attributes ),
121117
"PSEUDO": new RegExp( "^" + pseudos ),
122118
"CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +

0 commit comments

Comments
 (0)