X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fsupport.js;h=939ad4fcb55a457fe926552232ba2201b6dbf97b;hb=36647696b69c208c3c965d0f04603e55e184b784;hp=7f2591b5d03a5902c07f5bc033ee731e54f340fb;hpb=f0999076723d85e77d4ba73d7c464466b5a7dba1;p=jquery.git diff --git a/src/support.js b/src/support.js index 7f2591b..939ad4f 100644 --- a/src/support.js +++ b/src/support.js @@ -12,7 +12,8 @@ var all = div.getElementsByTagName("*"), a = div.getElementsByTagName("a")[0], select = document.createElement("select"), - opt = select.appendChild( document.createElement("option") ); + opt = select.appendChild( document.createElement("option") ), + input = div.getElementsByTagName("input")[0]; // Can't get basic test support if ( !all || !all.length || !a ) { @@ -51,7 +52,7 @@ // Make sure that if no value is specified for a checkbox // that it defaults to "on". // (WebKit defaults to "" instead) - checkOn: div.getElementsByTagName("input")[0].value === "on", + checkOn: input.value === "on", // 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) @@ -62,12 +63,17 @@ optDisabled: false, checkClone: false, noCloneEvent: true, + noCloneChecked: true, boxModel: null, inlineBlockNeedsLayout: false, shrinkWrapBlocks: false, - reliableHiddenOffsets: true + reliableHiddenOffsets: true, + reliableMarginRight: true }; + input.checked = true; + jQuery.support.noCloneChecked = input.cloneNode( true ).checked; + // Make sure that the options inside disabled selects aren't marked as disabled // (WebKit marks them as diabled) select.disabled = true; @@ -80,7 +86,6 @@ script = document.createElement("script"), id = "script" + jQuery.now(); - script.type = "text/javascript"; try { script.appendChild( document.createTextNode( "window." + id + "=1;" ) ); } catch(e) {} @@ -184,6 +189,17 @@ jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0; div.innerHTML = ""; + // Check if div with explicit width and no margin-right incorrectly + // gets computed margin-right based on width of container. For more + // info see bug #3333 + // Fails in WebKit before Feb 2011 nightlies + // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right + if ( document.defaultView && document.defaultView.getComputedStyle ) { + div.style.width = "1px"; + div.style.marginRight = "0"; + jQuery.support.reliableMarginRight = ( parseInt(document.defaultView.getComputedStyle(div).marginRight, 10) || 0 ) === 0; + } + body.removeChild( div ).style.display = "none"; div = tds = null; });