Skip to content

Commit

Permalink
Fixed the issue where weird characters were being used in ID selector…
Browse files Browse the repository at this point in the history
…s. Fixes jQuery bug #3913.
  • Loading branch information
jeresig committed Feb 15, 2009
1 parent 22c9c9b commit f0189d6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/selector.js
Expand Up @@ -6,7 +6,7 @@
*/
(function(){

var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g,
var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,
done = 0,
toString = Object.prototype.toString;

Expand Down
1 change: 1 addition & 0 deletions test/index.html
Expand Up @@ -50,6 +50,7 @@ <h2 id="userAgent"></h2>
<p id="sap">This link has <code><a href="#2" id="anchor2">class="blog"</a></code>: <a href="http://simon.incutio.com/" class="blog link" id="simon">Simon Willison's Weblog</a></p>

</div>
<span id="name+value"></span>
<p id="first">Try them out:</p>
<ul id="firstUL"></ul>
<ol id="empty"></ol>
Expand Down
4 changes: 3 additions & 1 deletion test/unit/selector.js
Expand Up @@ -69,7 +69,7 @@ test("broken", function() {
});

test("id", function() {
expect(27);
expect(28);
t( "ID Selector", "#body", ["body"] );
t( "ID Selector w/ Element", "body#body", ["body"] );
t( "ID Selector w/ Element", "ul#first", [] );
Expand Down Expand Up @@ -105,6 +105,8 @@ test("id", function() {

t( "Underscore ID", "#types_all", ["types_all"] );
t( "Dash ID", "#fx-queue", ["fx-queue"] );

t( "ID with weird characters in it", "#name\\+value", ["name+value"] );
});

test("class", function() {
Expand Down

0 comments on commit f0189d6

Please sign in to comment.