| 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; } |