* Ensure no comment nodes are returned in Selector queries (IE improperly returns comment nodes on getElementsByTagName("*")). Change Element#descendants to use Element#getElementsBySelector in order to avoid this issue. Closes #10220. [Jeff Gobel, Andrew Dupont]
This commit is contained in:
parent
b01903d92f
commit
c85285496b
@ -1,3 +1,5 @@
|
||||
* Ensure no comment nodes are returned in Selector queries (IE improperly returns comment nodes on getElementsByTagName("*")). Change Element#descendants to use Element#getElementsBySelector in order to avoid this issue. Closes #10220. [Jeff Gobel, Andrew Dupont]
|
||||
|
||||
* Re-enable the XPath approach in Selector for Safari 3. Falls back to the non-XPath version when it sees a problematic token. [Andrew Dupont]
|
||||
|
||||
* Fix a bug in the IE-specific Element#descendantOf logic. [Nicholas, Andrew Dupont]
|
||||
|
@ -181,7 +181,7 @@ Element.Methods = {
|
||||
},
|
||||
|
||||
descendants: function(element) {
|
||||
return $A($(element).getElementsByTagName('*')).each(Element.extend);
|
||||
return $(element).getElementsBySelector("*");
|
||||
},
|
||||
|
||||
firstDescendant: function(element) {
|
||||
|
@ -647,6 +647,16 @@ Object.extend(Selector, {
|
||||
}
|
||||
});
|
||||
|
||||
if (Prototype.Browser.IE) {
|
||||
// IE returns comment nodes on getElementsByTagName("*").
|
||||
// Filter them out.
|
||||
Selector.handlers.concat = function(a, b) {
|
||||
for (var i = 0, node; node = b[i]; i++)
|
||||
if (node.tagName !== "!") a.push(node);
|
||||
return a;
|
||||
};
|
||||
}
|
||||
|
||||
function $$() {
|
||||
return Selector.findChildElements(document, $A(arguments));
|
||||
}
|
||||
|
@ -189,6 +189,7 @@
|
||||
<span id="nav_test_prev_sibling"></span>
|
||||
|
||||
<ul id="navigation_test" style="display: none">
|
||||
<!-- comment node to screw things up -->
|
||||
<li class="first"><em>A</em></li>
|
||||
<li><em class="dim">B</em></li>
|
||||
<li id="navigation_test_c">
|
||||
|
Loading…
Reference in New Issue
Block a user