aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichał Gołębiowski <m.goleb@gmail.com>2015-11-16 21:39:00 +0100
committerMichał Gołębiowski <m.goleb@gmail.com>2015-11-16 22:04:20 +0100
commitafe40dd4d3d0c21e9c447eedb0a0382e8d1af5c6 (patch)
tree91820664232b11e718853ed9bbfe7b3899764ce6
parent1ad9915d11e27ebce8016ef81163206fb68b2335 (diff)
downloadjquery-afe40dd4d3d0c21e9c447eedb0a0382e8d1af5c6.tar.gz
jquery-afe40dd4d3d0c21e9c447eedb0a0382e8d1af5c6.zip
Revert "Ajax:Attributes:CSS:Manipulation: Reduce Android 2.3 support"
This reverts commit ce3b4a62427c5a3a6669dcb8bf8e27a6287990d5.
-rw-r--r--src/ajax/parseJSON.js6
-rw-r--r--src/attributes/support.js5
-rw-r--r--src/attributes/val.js3
-rw-r--r--src/css.js10
-rw-r--r--src/css/support.js28
-rw-r--r--test/unit/support.js91
6 files changed, 128 insertions, 15 deletions
diff --git a/src/ajax/parseJSON.js b/src/ajax/parseJSON.js
index c2aeb6aae..11918b06d 100644
--- a/src/ajax/parseJSON.js
+++ b/src/ajax/parseJSON.js
@@ -2,7 +2,11 @@ define( [
"../core"
], function( jQuery ) {
-jQuery.parseJSON = JSON.parse;
+// Support: Android 2.3
+// Workaround failure to string-cast null input
+jQuery.parseJSON = function( data ) {
+ return JSON.parse( data + "" );
+};
return jQuery.parseJSON;
diff --git a/src/attributes/support.js b/src/attributes/support.js
index 5b8118bb5..e8d02b5c9 100644
--- a/src/attributes/support.js
+++ b/src/attributes/support.js
@@ -18,6 +18,11 @@ 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 caf0126d4..9999d985b 100644
--- a/src/attributes/val.js
+++ b/src/attributes/val.js
@@ -105,7 +105,8 @@ jQuery.extend( {
if ( ( option.selected || i === index ) &&
// Don't return options that are disabled or in a disabled optgroup
- !option.disabled &&
+ ( support.optDisabled ?
+ !option.disabled : option.getAttribute( "disabled" ) === null ) &&
( !option.parentNode.disabled ||
!jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
diff --git a/src/css.js b/src/css.js
index 0aa9d0e9c..d9104ad3f 100644
--- a/src/css.js
+++ b/src/css.js
@@ -428,6 +428,16 @@ jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
}
);
+// 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 6070eb449..7e6e51334 100644
--- a/src/css/support.js
+++ b/src/css/support.js
@@ -84,6 +84,34 @@ define( [
computeStyleTests();
}
return reliableMarginLeftVal;
+ },
+ 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/test/unit/support.js b/test/unit/support.js
index 93fba8701..32ae17591 100644
--- a/test/unit/support.js
+++ b/test/unit/support.js
@@ -67,11 +67,13 @@ testIframeWithCallback(
"createHTMLDocument": true,
"focusin": false,
"noCloneChecked": true,
+ "optDisabled": true,
"optSelected": true,
"pixelMarginRight": true,
"pixelPosition": true,
"radioValue": true,
- "reliableMarginLeft": true
+ "reliableMarginLeft": true,
+ "reliableMarginLRight": true
};
} else if ( /opera.*version\/12\.1/i.test( userAgent ) ) {
expected = {
@@ -84,11 +86,13 @@ testIframeWithCallback(
"createHTMLDocument": true,
"focusin": false,
"noCloneChecked": true,
+ "optDisabled": true,
"optSelected": true,
"pixelMarginRight": true,
"pixelPosition": true,
"radioValue": false,
- "reliableMarginLeft": false
+ "reliableMarginLeft": false,
+ "reliableMarginRight": true
};
} else if ( /(msie 10\.0|trident\/7\.0)/i.test( userAgent ) ) {
expected = {
@@ -101,11 +105,13 @@ testIframeWithCallback(
"createHTMLDocument": true,
"focusin": true,
"noCloneChecked": false,
+ "optDisabled": true,
"optSelected": false,
"pixelMarginRight": true,
"pixelPosition": true,
"radioValue": false,
- "reliableMarginLeft": true
+ "reliableMarginLeft": true,
+ "reliableMarginRight": true
};
} else if ( /msie 9\.0/i.test( userAgent ) ) {
expected = {
@@ -118,11 +124,13 @@ testIframeWithCallback(
"createHTMLDocument": true,
"focusin": true,
"noCloneChecked": false,
+ "optDisabled": true,
"optSelected": false,
"pixelMarginRight": true,
"pixelPosition": true,
"radioValue": false,
- "reliableMarginLeft": true
+ "reliableMarginLeft": true,
+ "reliableMarginRight": true
};
} else if ( /chrome/i.test( userAgent ) ) {
@@ -138,11 +146,13 @@ testIframeWithCallback(
"createHTMLDocument": true,
"focusin": false,
"noCloneChecked": true,
+ "optDisabled": true,
"optSelected": true,
"pixelMarginRight": true,
"pixelPosition": true,
"radioValue": true,
- "reliableMarginLeft": true
+ "reliableMarginLeft": true,
+ "reliableMarginRight": true
};
} else if ( /9\.0(\.\d+|) safari/i.test( userAgent ) ) {
expected = {
@@ -155,11 +165,13 @@ testIframeWithCallback(
"createHTMLDocument": true,
"focusin": false,
"noCloneChecked": true,
+ "optDisabled": true,
"optSelected": true,
"pixelMarginRight": true,
"pixelPosition": false,
"radioValue": true,
- "reliableMarginLeft": true
+ "reliableMarginLeft": true,
+ "reliableMarginRight": true
};
} else if ( /8\.0(\.\d+|) safari/i.test( userAgent ) ) {
expected = {
@@ -172,11 +184,32 @@ testIframeWithCallback(
"createHTMLDocument": false,
"focusin": false,
"noCloneChecked": true,
+ "optDisabled": true,
"optSelected": true,
"pixelMarginRight": true,
"pixelPosition": false,
"radioValue": true,
- "reliableMarginLeft": true
+ "reliableMarginLeft": true,
+ "reliableMarginRight": true
+ };
+ } else if ( /(?:6|7)\.0(\.\d+|) safari/i.test( userAgent ) ) {
+ expected = {
+ "ajax": true,
+ "boxSizingReliable": true,
+ "checkClone": true,
+ "checkOn": true,
+ "clearCloneStyle": true,
+ "cors": true,
+ "createHTMLDocument": true,
+ "focusin": false,
+ "noCloneChecked": true,
+ "optDisabled": true,
+ "optSelected": true,
+ "pixelMarginRight": true,
+ "pixelPosition": false,
+ "radioValue": true,
+ "reliableMarginLeft": true,
+ "reliableMarginRight": true
};
} else if ( /5\.1(\.\d+|) safari/i.test( userAgent ) ) {
expected = {
@@ -186,12 +219,15 @@ testIframeWithCallback(
"checkOn": false,
"clearCloneStyle": true,
"cors": true,
- "focusinBubbles": false,
+ "createHTMLDocument": true,
+ "focusin": false,
"noCloneChecked": true,
"optDisabled": true,
"optSelected": true,
+ "pixelMarginRight": true,
"pixelPosition": false,
"radioValue": true,
+ "reliableMarginLeft": true,
"reliableMarginRight": true
};
} else if ( /firefox/i.test( userAgent ) ) {
@@ -205,11 +241,13 @@ testIframeWithCallback(
"createHTMLDocument": true,
"focusin": false,
"noCloneChecked": true,
+ "optDisabled": true,
"optSelected": true,
"pixelMarginRight": true,
"pixelPosition": true,
"radioValue": true,
- "reliableMarginLeft": false
+ "reliableMarginLeft": false,
+ "reliableMarginRight": true
};
} else if ( /iphone os 9_/i.test( userAgent ) ) {
expected = {
@@ -222,11 +260,13 @@ testIframeWithCallback(
"createHTMLDocument": true,
"focusin": false,
"noCloneChecked": true,
+ "optDisabled": true,
"optSelected": true,
"pixelMarginRight": true,
"pixelPosition": false,
"radioValue": true,
- "reliableMarginLeft": true
+ "reliableMarginLeft": true,
+ "reliableMarginLRight": true
};
} else if ( /iphone os 8_/i.test( userAgent ) ) {
expected = {
@@ -239,11 +279,13 @@ testIframeWithCallback(
"createHTMLDocument": false,
"focusin": false,
"noCloneChecked": true,
+ "optDisabled": true,
"optSelected": true,
"pixelMarginRight": true,
"pixelPosition": false,
"radioValue": true,
- "reliableMarginLeft": true
+ "reliableMarginLeft": true,
+ "reliableMarginRight": true
};
} else if ( /iphone os (?:6|7)_/i.test( userAgent ) ) {
expected = {
@@ -256,11 +298,13 @@ testIframeWithCallback(
"createHTMLDocument": true,
"focusin": false,
"noCloneChecked": true,
+ "optDisabled": true,
"optSelected": true,
"pixelMarginRight": true,
"pixelPosition": false,
"radioValue": true,
- "reliableMarginLeft": true
+ "reliableMarginLeft": true,
+ "reliableMarginRight": true
};
} else if ( /android 4\.[0-3]/i.test( userAgent ) ) {
expected = {
@@ -273,11 +317,32 @@ testIframeWithCallback(
"createHTMLDocument": true,
"focusin": false,
"noCloneChecked": true,
+ "optDisabled": true,
"optSelected": true,
"pixelMarginRight": false,
"pixelPosition": false,
"radioValue": true,
- "reliableMarginLeft": false
+ "reliableMarginLeft": false,
+ "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,
+ "reliableMarginLeft": false,
+ "reliableMarginRight": false
};
}