Last active
August 29, 2015 14:27
-
-
Save vmysla/ed1daad8109ea1ba811e to your computer and use it in GitHub Desktop.
Frameless document.querySelectorAll shim
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// @usage document.querySelectorAll('body'); | |
/// @returns array of matched elements from document and his IFRAMEs (CORS) | |
document.querySelectorAll = function(){ | |
var result = [].slice.call( HTMLDocument.prototype.querySelectorAll.apply(document, arguments ) ); | |
for(var i=0; i< frames.length; i++){ | |
try { | |
var doc = frames[i].document; | |
result = result.concat( [].slice.call( doc.querySelectorAll.apply(doc, arguments) ) ); | |
} catch(e){} | |
} | |
return result; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment