Bug Tracker

Changeset 1595

Show
Ignore:
Timestamp:
03/25/07 20:30:16 (1 year ago)
Author:
john
Message:

Opera is also vulnerable to the getElementById-returning-name issue, fixed it there as well. Also had to tweak the UTF8 regexps to work in Safari (Safari doesn't support \uXXXX in RegExps?, lame.)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/jquery/src/selector/selector.js

    r1593 r1595  
    7777 
    7878        // Match: :even, :last-chlid, #id, .class 
    79         /^([:.#]*)((?:[\w\u0128-\uFFFF*-]|\\.)+)/ 
     79        new RegExp("^([:.#]*)(" +  
     80            ( jQuery.chars = "(?:[\\w\u0128-\uFFFF*-]|\\\\.)" ) + "+)") 
    8081    ], 
    8182 
     
    205206                } else { 
    206207                    // Optomize for the case nodeName#idName 
    207                     var re2 = /^(\w+)(#)((?:[\w\u0128-\uFFFF*-]|\\.)+)/; 
     208                    var re2 = new RegExp("^(\\w+)(#)(" + jQuery.chars + "+)"); 
    208209                    var m = re2.exec(t); 
    209210                     
     
    215216                        // Otherwise, do a traditional filter check for 
    216217                        // ID, class, and element selectors 
    217                         re2 = /^([#.]?)((?:[\w\u0128-\uFFFF*-]|\\.)*)/; 
     218                        re2 = new RegExp("^([#.]?)(" + jQuery.chars + "*)"); 
    218219                        m = re2.exec(t); 
    219220                    } 
     
    230231                        // Do a quick check for the existence of the actual ID attribute 
    231232                        // to avoid selecting by the name attribute in IE 
    232                         if ( jQuery.browser.msie && oid && oid.id != m[2] ) 
     233                        if ( (jQuery.browser.msie||jQuery.browser.opera) && oid && oid.id != m[2] ) 
    233234                            oid = jQuery('[@id="'+m[2]+'"]', elem)[0]; 
    234235 
     
    238239 
    239240                    } else { 
    240                         // We need to find all descendant elements, it is more 
    241                         // efficient to use getAll() when we are already further down 
    242                         // the tree - we try to recognize that here 
     241                        // We need to find all descendant elements 
    243242                        for ( var i = 0, rl = ret.length; i < rl; i++ ) { 
    244243                            // Grab the tag name being searched for