X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fsupport.js;h=97b4a4263748cfa75896f1fb7bf22c20d18bbf7c;hb=a43a5ca9cf79afcd662df5b9110d7ccba45c0b53;hp=7be28fdaf43d9f124788a36c7fc1bbd2b8474cc9;hpb=9c763ad39d42c54d24f659e7895a8f361a08d27c;p=jquery.git diff --git a/src/support.js b/src/support.js index 7be28fd..97b4a42 100644 --- a/src/support.js +++ b/src/support.js @@ -61,7 +61,6 @@ deleteExpando: true, optDisabled: false, checkClone: false, - _scriptEval: null, noCloneEvent: true, boxModel: null, inlineBlockNeedsLayout: false, @@ -74,13 +73,13 @@ select.disabled = true; jQuery.support.optDisabled = !opt.disabled; + var _scriptEval = null; jQuery.support.scriptEval = function() { - if ( jQuery.support._scriptEval === null ) { + if ( _scriptEval === null ) { var root = document.documentElement, script = document.createElement("script"), id = "script" + jQuery.now(); - script.type = "text/javascript"; try { script.appendChild( document.createTextNode( "window." + id + "=1;" ) ); } catch(e) {} @@ -91,10 +90,10 @@ // tag with appendChild/createTextNode // (IE doesn't support this, fails, and uses .text instead) if ( window[ id ] ) { - jQuery.support._scriptEval = true; + _scriptEval = true; delete window[ id ]; } else { - jQuery.support._scriptEval = false; + _scriptEval = false; } root.removeChild( script ); @@ -102,7 +101,7 @@ root = script = id = null; } - return jQuery.support._scriptEval; + return _scriptEval; }; // Test to see if it's possible to delete an expando from an element @@ -114,7 +113,7 @@ jQuery.support.deleteExpando = false; } - if ( div.attachEvent && div.fireEvent ) { + if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { div.attachEvent("onclick", function click() { // Cloning a node shouldn't copy over any // bound event handlers (IE does this) @@ -136,10 +135,16 @@ // Figure out if the W3C box model works as expected // document.body must exist before we can do this jQuery(function() { - var div = document.createElement("div"); - div.style.width = div.style.paddingLeft = "1px"; + var div = document.createElement("div"), + body = document.getElementsByTagName("body")[0]; + + // Frameset documents with no body should not run this code + if ( !body ) { + return; + } - document.body.appendChild( div ); + div.style.width = div.style.paddingLeft = "1px"; + body.appendChild( div ); jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2; if ( "zoom" in div.style ) { @@ -178,7 +183,7 @@ jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0; div.innerHTML = ""; - document.body.removeChild( div ).style.display = "none"; + body.removeChild( div ).style.display = "none"; div = tds = null; });