Fixed the issue where weird characters were being used in ID selectors. Fixes jQuery...
authorJohn Resig <jeresig@gmail.com>
Sun, 15 Feb 2009 22:46:54 +0000 (22:46 +0000)
committerJohn Resig <jeresig@gmail.com>
Sun, 15 Feb 2009 22:46:54 +0000 (22:46 +0000)
src/selector.js
test/index.html
test/unit/selector.js

index 4177672..42e7e41 100644 (file)
@@ -6,7 +6,7 @@
  */
 (function(){
 
-var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g,
+var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,
        done = 0,
        toString = Object.prototype.toString;
 
index c415d11..e0389ac 100644 (file)
@@ -50,6 +50,7 @@
                        <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>
index 419116e..341d59b 100644 (file)
@@ -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", [] );
@@ -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() {