From ce3b4a62427c5a3a6669dcb8bf8e27a6287990d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Go=C5=82=C4=99biowski?= Date: Mon, 20 Jul 2015 19:24:46 +0200 Subject: [PATCH] Ajax:Attributes:CSS:Manipulation: Reduce Android 2.3 support Drop non-critical workarounds for Android 2.3. Fixes gh-2483 Fixes gh-2505 Closes gh-2581 --- src/ajax/parseJSON.js | 6 +--- src/attributes/support.js | 5 ---- src/attributes/val.js | 3 +- src/css.js | 10 ------- src/css/support.js | 33 +-------------------- src/manipulation/wrapMap.js | 5 ++-- test/unit/support.js | 58 +++++++------------------------------ 7 files changed, 15 insertions(+), 105 deletions(-) diff --git a/src/ajax/parseJSON.js b/src/ajax/parseJSON.js index 11918b06d..c2aeb6aae 100644 --- a/src/ajax/parseJSON.js +++ b/src/ajax/parseJSON.js @@ -2,11 +2,7 @@ define( [ "../core" ], function( jQuery ) { -// Support: Android 2.3 -// Workaround failure to string-cast null input -jQuery.parseJSON = function( data ) { - return JSON.parse( data + "" ); -}; +jQuery.parseJSON = JSON.parse; return jQuery.parseJSON; diff --git a/src/attributes/support.js b/src/attributes/support.js index 13bcd4572..f93ba0181 100644 --- a/src/attributes/support.js +++ b/src/attributes/support.js @@ -18,11 +18,6 @@ define( [ // Must access selectedIndex to make default options select support.optSelected = opt.selected; - // Support: Android<=2.3 - // Options inside disabled selects are incorrectly marked as disabled - select.disabled = true; - support.optDisabled = !opt.disabled; - // Support: IE<=11+ // An input loses its value after becoming a radio input = document.createElement( "input" ); diff --git a/src/attributes/val.js b/src/attributes/val.js index 9999d985b..caf0126d4 100644 --- a/src/attributes/val.js +++ b/src/attributes/val.js @@ -105,8 +105,7 @@ jQuery.extend( { if ( ( option.selected || i === index ) && // Don't return options that are disabled or in a disabled optgroup - ( support.optDisabled ? - !option.disabled : option.getAttribute( "disabled" ) === null ) && + !option.disabled && ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { diff --git a/src/css.js b/src/css.js index 8a86ef55c..ccf0cc85e 100644 --- a/src/css.js +++ b/src/css.js @@ -351,16 +351,6 @@ jQuery.each( [ "height", "width" ], function( i, name ) { }; } ); -// Support: Android 2.3 -jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight, - function( elem, computed ) { - if ( computed ) { - return swap( elem, { "display": "inline-block" }, - curCSS, [ elem, "marginRight" ] ); - } - } -); - // These hooks are used by animate to expand properties jQuery.each( { margin: "", diff --git a/src/css/support.js b/src/css/support.js index 0758fa8a4..08560b42a 100644 --- a/src/css/support.js +++ b/src/css/support.js @@ -29,10 +29,7 @@ define( [ // so they're executed at the same time to save the second computation. function computeStyleTests() { div.style.cssText = - - // Support: Android 2.3 - // Vendor-prefix box-sizing - "-webkit-box-sizing:border-box;box-sizing:border-box;" + + "box-sizing:border-box;" + "display:block;position:absolute;" + "margin:0;margin-top:1%;margin-right:50%;" + "border:1px;padding:1px;" + @@ -72,34 +69,6 @@ define( [ 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" ) ); - - // 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 ).marginRight ); - - documentElement.removeChild( container ); - div.removeChild( marginDiv ); - - return ret; } } ); } )(); diff --git a/src/manipulation/wrapMap.js b/src/manipulation/wrapMap.js index 3fa5f913e..a7b913c90 100644 --- a/src/manipulation/wrapMap.js +++ b/src/manipulation/wrapMap.js @@ -12,9 +12,8 @@ var wrapMap = { // their parent elements (except for "table" element) could be omitted // since browser parsers are smart enough to auto-insert them - // Support: Android 2.3 - // Android browser doesn't auto-insert colgroup - col: [ 2, "", "
" ], + // Auto-insert "colgroup" element + col: [ 2, "", "
" ], // Auto-insert "tbody" element tr: [ 2, "", "
" ], diff --git a/test/unit/support.js b/test/unit/support.js index e53a5f0ec..8c6b0a28b 100644 --- a/test/unit/support.js +++ b/test/unit/support.js @@ -67,12 +67,10 @@ testIframeWithCallback( "createHTMLDocument": true, "focusin": false, "noCloneChecked": true, - "optDisabled": true, "optSelected": true, "pixelMarginRight": true, "pixelPosition": true, - "radioValue": true, - "reliableMarginRight": true + "radioValue": true }; } else if ( /(msie 10\.0|trident\/7\.0)/i.test( userAgent ) ) { expected = { @@ -85,12 +83,10 @@ testIframeWithCallback( "createHTMLDocument": true, "focusin": true, "noCloneChecked": false, - "optDisabled": true, "optSelected": false, "pixelMarginRight": true, "pixelPosition": true, - "radioValue": false, - "reliableMarginRight": true + "radioValue": false }; } else if ( /msie 9\.0/i.test( userAgent ) ) { expected = { @@ -103,12 +99,10 @@ testIframeWithCallback( "createHTMLDocument": true, "focusin": true, "noCloneChecked": false, - "optDisabled": true, "optSelected": false, "pixelMarginRight": true, "pixelPosition": true, - "radioValue": false, - "reliableMarginRight": true + "radioValue": false }; } else if ( /chrome/i.test( userAgent ) ) { @@ -124,12 +118,10 @@ testIframeWithCallback( "createHTMLDocument": true, "focusin": false, "noCloneChecked": true, - "optDisabled": true, "optSelected": true, "pixelMarginRight": true, "pixelPosition": true, - "radioValue": true, - "reliableMarginRight": true + "radioValue": true }; } else if ( /8\.0(\.\d+|) safari/i.test( userAgent ) ) { expected = { @@ -142,12 +134,10 @@ testIframeWithCallback( "createHTMLDocument": false, "focusin": false, "noCloneChecked": true, - "optDisabled": true, "optSelected": true, "pixelMarginRight": true, "pixelPosition": false, - "radioValue": true, - "reliableMarginRight": true + "radioValue": true }; } else if ( /7\.0(\.\d+|) safari/i.test( userAgent ) ) { expected = { @@ -160,12 +150,10 @@ testIframeWithCallback( "createHTMLDocument": true, "focusin": false, "noCloneChecked": true, - "optDisabled": true, "optSelected": true, "pixelMarginRight": true, "pixelPosition": false, - "radioValue": true, - "reliableMarginRight": true + "radioValue": true }; } else if ( /firefox/i.test( userAgent ) ) { expected = { @@ -178,12 +166,10 @@ testIframeWithCallback( "createHTMLDocument": true, "focusin": false, "noCloneChecked": true, - "optDisabled": true, "optSelected": true, "pixelMarginRight": true, "pixelPosition": true, - "radioValue": true, - "reliableMarginRight": true + "radioValue": true }; } else if ( /iphone os 8/i.test( userAgent ) ) { expected = { @@ -196,12 +182,10 @@ testIframeWithCallback( "createHTMLDocument": false, "focusin": false, "noCloneChecked": true, - "optDisabled": true, "optSelected": true, "pixelMarginRight": true, "pixelPosition": false, - "radioValue": true, - "reliableMarginRight": true + "radioValue": true }; } else if ( /iphone os (6|7)/i.test( userAgent ) ) { expected = { @@ -214,12 +198,10 @@ testIframeWithCallback( "createHTMLDocument": true, "focusin": false, "noCloneChecked": true, - "optDisabled": true, "optSelected": true, "pixelMarginRight": true, "pixelPosition": false, - "radioValue": true, - "reliableMarginRight": true + "radioValue": true }; } else if ( /android 4\.[0-3]/i.test( userAgent ) ) { expected = { @@ -232,30 +214,10 @@ testIframeWithCallback( "createHTMLDocument": true, "focusin": false, "noCloneChecked": true, - "optDisabled": true, "optSelected": true, "pixelMarginRight": false, "pixelPosition": false, - "radioValue": true, - "reliableMarginRight": true - }; - } else if ( /android 2\.3/i.test( userAgent ) ) { - expected = { - "ajax": true, - "boxSizingReliable": true, - "checkClone": true, - "checkOn": false, - "clearCloneStyle": false, - "cors": true, - "createHTMLDocument": true, - "focusin": false, - "noCloneChecked": true, - "optDisabled": false, - "optSelected": true, - "pixelMarginRight": true, - "pixelPosition": false, - "radioValue": true, - "reliableMarginRight": false + "radioValue": true }; }