X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fsupport.js;h=299fbd2774fe52bd526a9538a46d68fa4ce1857d;hb=0229b83f7e5bf64edb2888ab349bedcd1a45e7c1;hp=cddd3dc3b962af886a59cf9d3c6468bfe66b787d;hpb=b3ccf2f2881d9ad988aba1cf3ccffb810063ab29;p=jquery.git diff --git a/src/support.js b/src/support.js index cddd3dc..299fbd2 100644 --- a/src/support.js +++ b/src/support.js @@ -1,3 +1,5 @@ +(function( jQuery ) { + (function() { jQuery.support = {}; @@ -11,7 +13,9 @@ div.innerHTML = "
a"; var all = div.getElementsByTagName("*"), - a = div.getElementsByTagName("a")[0]; + a = div.getElementsByTagName("a")[0], + select = document.createElement("select"), + opt = select.appendChild( document.createElement("option") ); // Can't get basic test support if ( !all || !all.length || !a ) { @@ -54,15 +58,22 @@ // Make sure that a selected-by-default option has a working selected property. // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) - optSelected: document.createElement("select").appendChild( document.createElement("option") ).selected, + optSelected: opt.selected, // Will be defined later + optDisabled: false, checkClone: false, scriptEval: false, noCloneEvent: true, - boxModel: null + boxModel: null, + reliableHiddenOffsets: true }; + // Make sure that the options inside disabled selects aren't marked as disabled + // (WebKit marks them as diabled) + select.disabled = true; + jQuery.support.optDisabled = !opt.disabled; + script.type = "text/javascript"; try { script.appendChild( document.createTextNode( "window." + id + "=1;" ) ); @@ -107,6 +118,18 @@ document.body.appendChild( div ); jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2; + + // Check if table cells still have offsetWidth/Height when they are set + // to display:none and there are still other visible table cells in a + // table row; if so, offsetWidth/Height are not reliable for use when + // determining if an element has been hidden directly using + // display:none (it is still safe to use offsets if a parent element is + // hidden; don safety goggles and see bug #4512 for more information). + // (only IE 8 fails this test) + div.innerHTML = '
t
'; + jQuery.support.reliableHiddenOffsets = div.getElementsByTagName('td')[0].offsetHeight === 0; + div.innerHTML = ''; + document.body.removeChild( div ).style.display = 'none'; div = null; }); @@ -146,3 +169,5 @@ jQuery.props = { usemap: "useMap", frameborder: "frameBorder" }; + +})( jQuery );