useful JS snippets
Wednesday, 12. April 2006, 12:09:24
function objinspect(obj){var s='';for(var e in obj)s+=e+':'+obj[e]+'\n';opera.postError(s);}
Call it with the object you want to look at, for example objinspect(window); .
To emulate the document.load method in Opera:
if(!Document.prototype.load){
Document.prototype.load=function(uri){
if(this.documentElement){this.removeChild(this.documentElement);}
var doc=(document.implementation.createLSParser( document.implementation.MODE_SYNCHRONOUS, null )).parseURI(uri);
this.appendChild(this.importNode(doc.documentElement, true));
}
}
BTW, why does Mozilla's document.load documentation claim that this method is from the DOM3 Load and Save spec when it isn't mentioned there?
To see all code that will be passed to eval() before evaluating it:
window.eval=(function(e){return function(s){opera.postError(s);return e(s);}})(window.eval);









Hallvord R. M. Steen # 12. April 2006, 12:39
Jeroen Hoekx # 14. April 2006, 11:12
It was in an old working draft : http://www.w3.org/TR/2003/WD-DOM-Level-3-LS-20030619/load-save.html#LS-DocumentLS