Skip to content

Commit f9503a2

Browse files
committed
fixes mootools/mootools-core#2362, these lines were throwing XML errors on firefox with XML documents, its possible to see the errors here: http://willdaniels.co.uk/files/xhtml-test.php Thank you @wdaniels for the report
1 parent 7c34d63 commit f9503a2

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

Source/Slick.Finder.js

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,14 @@ local.setDocument = function(document){
9393
starSelectsComments = (testNode.getElementsByTagName('*').length > 1);
9494

9595
// IE returns closed nodes (EG:"</foo>") for getElementsByTagName('*') for some documents
96-
try {
97-
testNode.innerHTML = 'foo</foo>';
98-
selected = testNode.getElementsByTagName('*');
99-
starSelectsClosed = (selected && !!selected.length && selected[0].nodeName.charAt(0) == '/');
100-
} catch(e){}
96+
// Should never inject incorrect markup on XML documents
97+
if (!features.isXMLDocument){
98+
try {
99+
testNode.innerHTML = 'foo</foo>';
100+
selected = testNode.getElementsByTagName('*');
101+
starSelectsClosed = (selected && !!selected.length && selected[0].nodeName.charAt(0) == '/');
102+
} catch(e){}
103+
}
101104

102105
features.brokenStarGEBTN = starSelectsComments || starSelectsClosed;
103106

@@ -136,11 +139,14 @@ local.setDocument = function(document){
136139

137140
if (testNode.querySelectorAll){
138141
// IE 8 returns closed nodes (EG:"</foo>") for querySelectorAll('*') for some documents
139-
try {
140-
testNode.innerHTML = 'foo</foo>';
141-
selected = testNode.querySelectorAll('*');
142-
features.starSelectsClosedQSA = (selected && !!selected.length && selected[0].nodeName.charAt(0) == '/');
143-
} catch(e){}
142+
// Should never inject incorrect markup on XML documents
143+
if (!features.isXMLDocument){
144+
try {
145+
testNode.innerHTML = 'foo</foo>';
146+
selected = testNode.querySelectorAll('*');
147+
features.starSelectsClosedQSA = (selected && !!selected.length && selected[0].nodeName.charAt(0) == '/');
148+
} catch(e){}
149+
}
144150

145151
// Safari 3.2 querySelectorAll doesnt work with mixedcase on quirksmode
146152
try {

0 commit comments

Comments
 (0)