miscoded

the web is a hack

useful JS snippets

, ,

To see all direct properties and methods of an object (does not recurse):

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);

how to shoot yourself in the menu with a variablekey events

Comments

Hallvord R. M. Steenhallvors Wednesday, April 12, 2006 12:39:49 PM

Um, "illegal use of eval" error. That's what I get for blogging *while* working rather than *after*. window.eval=window.alert; gets you only so far..

Jeroen HoekxJeroenH Friday, April 14, 2006 11:12:00 AM

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?



It was in an old working draft : http://www.w3.org/TR/2003/WD-DOM-Level-3-LS-20030619/load-save.html#LS-DocumentLS

Write a comment

You must be logged in to write a comment. If you're not a registered member, please sign up.