Changeset 7660

Show
Ignore:
Timestamp:
03/19/07 01:49:24 (22 months ago)
Author:
alex
Message:

go straight for the document.all case in IE. Refs #2500

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • dojo/trunk/_base/_loader/hostenv_browser.js

    r7659 r7660  
    304304                        //              optional, defaults to the current value of dojo._currentDocument. 
    305305                        //              Can be used to retreive node references from other documents. 
     306 
    306307                        if((id)&&((typeof id == "string")||(id instanceof String))){ 
    307                                 doc = doc||dojo.doc(); 
    308                                 var ele = doc.getElementById(id); 
    309                                 // workaround bug in IE and Opera 8.2 where getElementById 
    310                                 // returns wrong element 
    311                                 if(ele && (ele.id != id)){ 
    312                                         ele = null; 
    313                                         // get all matching elements with this id 
    314                                         var eles = doc.all[id]; 
    315                                         if(!eles.length){ return eles; } 
    316                                         // if more than 1, choose first with the correct id 
    317                                         var i=0, te; 
    318                                         while(te=eles[i++]){ 
    319                                                 if(te.id == id){ return te; } 
    320                                         } 
     308                                var eles = doc.all[id]; 
     309                                if(!eles.length){ return eles; } 
     310                                // if more than 1, choose first with the correct id 
     311                                var i=0, te; 
     312                                while(te=eles[i++]){ 
     313                                        if(te.id == id){ return te; } 
    321314                                } 
    322                                 return ele; // DomNode 
    323315                        } 
    324316                        return id; // DomNode