]> source.dussan.org Git - jquery.git/commitdiff
Core: Update tested jsdom, drop obsolete workarounds 2154/head
authorMichał Gołębiowski <m.goleb@gmail.com>
Fri, 20 Mar 2015 15:28:10 +0000 (16:28 +0100)
committerMichał Gołębiowski <m.goleb@gmail.com>
Mon, 30 Mar 2015 16:58:09 +0000 (18:58 +0200)
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

package.json
src/core/support.js
src/css/support.js

index c8218539c0063d307aba24a965c6a7a54bbc14de..623fe44e182321b9d5551ec9c41ff04f318a9404 100644 (file)
@@ -42,7 +42,7 @@
     "grunt-jsonlint": "1.0.4",
     "grunt-npmcopy": "0.1.0",
     "gzip-js": "0.3.2",
-    "jsdom": "1.5.0",
+    "jsdom": "3.1.2",
     "load-grunt-tasks": "1.0.0",
     "native-promise-only": "0.7.8-a",
     "npm": "2.1.12",
index 7fc1d82b2183fc85edded4b80ead5d3db33111e9..4ef1dacab95b1e25333056e44137b1945a24a39c 100644 (file)
@@ -4,14 +4,9 @@ define([
 ], function( document, support ) {
 
 support.createHTMLDocument = (function() {
-       var doc = document.implementation.createHTMLDocument( "" );
-       // Support: Node with jsdom<=1.5.0+
-       // jsdom's document created via the above method doesn't contain the body
-       if ( !doc.body ) {
-               return false;
-       }
-       doc.body.innerHTML = "<form></form><form></form>";
-       return doc.body.childNodes.length === 2;
+       var body = document.implementation.createHTMLDocument( "" ).body;
+       body.innerHTML = "<form></form><form></form>";
+       return body.childNodes.length === 2;
 })();
 
 return support;
index 4dd22bd2a2f4631794d6bc37bf6c0b4b3d771596..fde7353181f79258686de47e8d6a1baeec5ca798 100644 (file)
@@ -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;