Ticket #11474: select_id_ie_patch_jd.diff
| File select_id_ie_patch_jd.diff, 1.7 kB (added by jdalton, 8 months ago) |
|---|
-
src/selector.js
old new 670 670 for (var i = 0, node; node = nodes[i]; i++) 671 671 node.removeAttribute('_countedByPrototype'); 672 672 return nodes; 673 } 674 }); 673 }, 674 675 // IE doesn't find elements by id if they are not attached to the document 676 id: Selector.handlers.id.wrap(function(proceed, nodes, root, id, combinator) { 677 var targetNode = $(id); 678 if (!targetNode && (root.sourceIndex < 1 || root == document)) { 679 var nodes = root.getElementsByTagName('*'), i = nodes.length; 680 while(i){ //faster than for-loop? 681 if(nodes[--i].id == id) { 682 targetNode = nodes[i]; break; 683 } 684 } 685 } 686 return proceed(nodes, root, targetNode, combinator); 687 }) 688 }); 675 689 } 676 690 677 691 function $$() { -
test/unit/selector.html
old new 459 459 Selector.matchElements($('counted_container').descendants(), 'div'), 'div.is_counted', 460 460 'div.is_counted' 461 461 ); 462 }, 463 464 testSelectorNotInsertedNodes: function() { 465 var wrapper = new Element("div"); 466 wrapper.update("<table><tr><td id='myTD'></td></tr></table>"); 467 new Selector('[id=myTD]').findElements(wrapper); 468 this.assertNotNullOrUndefined(wrapper.select('[id=myTD]')[0]); 469 this.assertNotNullOrUndefined(wrapper.select('td')[0]); 470 this.assertNotNullOrUndefined(wrapper.select('#myTD')[0]); 462 471 } 463 472 }); 464 473