Commit 1c35f381 authored by Vladislav Zarakovsky's avatar Vladislav Zarakovsky Committed by Dave Methvin

Fix #11337. Properly calculate $.support.reliableMarginRight.

parent 52816619
...@@ -8,7 +8,6 @@ jQuery.support = (function() { ...@@ -8,7 +8,6 @@ jQuery.support = (function() {
select, select,
opt, opt,
input, input,
marginDiv,
fragment, fragment,
tds, tds,
events, events,
...@@ -143,23 +142,6 @@ jQuery.support = (function() { ...@@ -143,23 +142,6 @@ jQuery.support = (function() {
fragment.removeChild( input ); fragment.removeChild( input );
fragment.appendChild( div ); fragment.appendChild( div );
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 ( window.getComputedStyle ) {
marginDiv = document.createElement( "div" );
marginDiv.style.width = "0";
marginDiv.style.marginRight = "0";
div.style.width = "2px";
div.appendChild( marginDiv );
support.reliableMarginRight =
( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
}
// Technique from Juriy Zaytsev // Technique from Juriy Zaytsev
// http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
// We only care about the case where non-standard event systems // We only care about the case where non-standard event systems
...@@ -185,12 +167,12 @@ jQuery.support = (function() { ...@@ -185,12 +167,12 @@ jQuery.support = (function() {
fragment.removeChild( div ); fragment.removeChild( div );
// Null elements to avoid leaks in IE // Null elements to avoid leaks in IE
fragment = select = opt = marginDiv = div = input = null; fragment = select = opt = div = input = null;
// Run tests that need a body at doc ready // Run tests that need a body at doc ready
jQuery(function() { jQuery(function() {
var container, outer, inner, table, td, offsetSupport, var container, outer, inner, table, td, offsetSupport,
conMarginTop, ptlm, vb, style, html, marginDiv, conMarginTop, ptlm, vb, style, html,
body = document.getElementsByTagName("body")[0]; body = document.getElementsByTagName("body")[0];
if ( !body ) { if ( !body ) {
...@@ -233,6 +215,22 @@ jQuery.support = (function() { ...@@ -233,6 +215,22 @@ jQuery.support = (function() {
// (IE <= 8 fail this test) // (IE <= 8 fail this test)
support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
// 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 ( window.getComputedStyle ) {
div.innerHTML = "";
marginDiv = document.createElement( "div" );
marginDiv.style.width = "0";
marginDiv.style.marginRight = "0";
div.style.width = "2px";
div.appendChild( marginDiv );
support.reliableMarginRight =
( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
}
// Figure out if the W3C box model works as expected // Figure out if the W3C box model works as expected
div.innerHTML = ""; div.innerHTML = "";
div.style.width = div.style.paddingLeft = "1px"; div.style.width = div.style.paddingLeft = "1px";
...@@ -289,7 +287,7 @@ jQuery.support = (function() { ...@@ -289,7 +287,7 @@ jQuery.support = (function() {
} }
body.removeChild( container ); body.removeChild( container );
div = container = null; marginDiv = div = container = null;
jQuery.extend( support, offsetSupport ); jQuery.extend( support, offsetSupport );
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment