diff options
author | Michał Gołębiowski <m.goleb@gmail.com> | 2015-03-20 16:28:10 +0100 |
---|---|---|
committer | Michał Gołębiowski <m.goleb@gmail.com> | 2015-03-30 18:58:09 +0200 |
commit | 06f6cd1ffd2a4e9f5955d146d229492f245d83cb (patch) | |
tree | ed069bb60fb75da8c8efa6a3a6ccdfdf6be4b563 /src/css/support.js | |
parent | f5aa89af7029ae6b9203c2d3e551a8554a0b4b89 (diff) | |
download | jquery-06f6cd1ffd2a4e9f5955d146d229492f245d83cb.tar.gz jquery-06f6cd1ffd2a4e9f5955d146d229492f245d83cb.zip |
Core: Update tested jsdom, drop obsolete workarounds
The latest version supporting Node.js is 3.1.2; some workarounds are not needed
for this version. For example, in jsdom 3.1.2 a document created via
document.implementation.createHTMLDocument( "" ) has a body.
Fixes gh-2153
Closes gh-2154
Diffstat (limited to 'src/css/support.js')
-rw-r--r-- | src/css/support.js | 94 |
1 files changed, 45 insertions, 49 deletions
diff --git a/src/css/support.js b/src/css/support.js index 4dd22bd2a..fde735318 100644 --- a/src/css/support.js +++ b/src/css/support.js @@ -46,61 +46,57 @@ define([ documentElement.removeChild( container ); } - // Support: node.js jsdom - // Don't assume that getComputedStyle is a property of the global object - if ( window.getComputedStyle ) { - jQuery.extend( support, { - pixelPosition: function() { - // This test is executed only once but we still do memoizing - // since we can use the boxSizingReliable pre-computing. - // No need to check if the test was already performed, though. + jQuery.extend( support, { + pixelPosition: function() { + // This test is executed only once but we still do memoizing + // since we can use the boxSizingReliable pre-computing. + // No need to check if the test was already performed, though. + computeStyleTests(); + return pixelPositionVal; + }, + boxSizingReliable: function() { + if ( boxSizingReliableVal == null ) { computeStyleTests(); - return pixelPositionVal; - }, - boxSizingReliable: function() { - if ( boxSizingReliableVal == null ) { - computeStyleTests(); - } - return boxSizingReliableVal; - }, - pixelMarginRight: function() { - // Support: Android 4.0-4.3 - // We're checking for boxSizingReliableVal here instead of pixelMarginRightVal - // since that compresses better and they're computed together anyway. - if ( boxSizingReliableVal == null ) { - computeStyleTests(); - } - return pixelMarginRightVal; - }, - reliableMarginRight: function() { + } + return boxSizingReliableVal; + }, + pixelMarginRight: function() { + // Support: Android 4.0-4.3 + // We're checking for boxSizingReliableVal here instead of pixelMarginRightVal + // since that compresses better and they're computed together anyway. + if ( boxSizingReliableVal == null ) { + computeStyleTests(); + } + return pixelMarginRightVal; + }, + reliableMarginRight: function() { - // Support: Android 2.3 - // Check if div with explicit width and no margin-right incorrectly - // gets computed margin-right based on width of container. (#3333) - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - // This support function is only executed once so no memoizing is needed. - var ret, - marginDiv = div.appendChild( document.createElement( "div" ) ); + // Support: Android 2.3 + // Check if div with explicit width and no margin-right incorrectly + // gets computed margin-right based on width of container. (#3333) + // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right + // This support function is only executed once so no memoizing is needed. + var ret, + marginDiv = div.appendChild( document.createElement( "div" ) ); - // Reset CSS: box-sizing; display; margin; border; padding - marginDiv.style.cssText = div.style.cssText = - // Support: Android 2.3 - // Vendor-prefix box-sizing - "-webkit-box-sizing:content-box;box-sizing:content-box;" + - "display:block;margin:0;border:0;padding:0"; - marginDiv.style.marginRight = marginDiv.style.width = "0"; - div.style.width = "1px"; - documentElement.appendChild( container ); + // Reset CSS: box-sizing; display; margin; border; padding + marginDiv.style.cssText = div.style.cssText = + // Support: Android 2.3 + // Vendor-prefix box-sizing + "-webkit-box-sizing:content-box;box-sizing:content-box;" + + "display:block;margin:0;border:0;padding:0"; + marginDiv.style.marginRight = marginDiv.style.width = "0"; + div.style.width = "1px"; + documentElement.appendChild( container ); - ret = !parseFloat( window.getComputedStyle( marginDiv, null ).marginRight ); + ret = !parseFloat( window.getComputedStyle( marginDiv, null ).marginRight ); - documentElement.removeChild( container ); - div.removeChild( marginDiv ); + documentElement.removeChild( container ); + div.removeChild( marginDiv ); - return ret; - } - }); - } + return ret; + } + }); })(); return support; |