Skip to content

Commit afe40dd

Browse files
committed
Revert "Ajax:Attributes:CSS:Manipulation: Reduce Android 2.3 support"
This reverts commit ce3b4a6.
1 parent 1ad9915 commit afe40dd

File tree

6 files changed

+128
-15
lines changed

6 files changed

+128
-15
lines changed

src/ajax/parseJSON.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ define( [
22
"../core"
33
], function( jQuery ) {
44

5-
jQuery.parseJSON = JSON.parse;
5+
// Support: Android 2.3
6+
// Workaround failure to string-cast null input
7+
jQuery.parseJSON = function( data ) {
8+
return JSON.parse( data + "" );
9+
};
610

711
return jQuery.parseJSON;
812

src/attributes/support.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ define( [
1818
// Must access selectedIndex to make default options select
1919
support.optSelected = opt.selected;
2020

21+
// Support: Android<=2.3
22+
// Options inside disabled selects are incorrectly marked as disabled
23+
select.disabled = true;
24+
support.optDisabled = !opt.disabled;
25+
2126
// Support: IE<=11+
2227
// An input loses its value after becoming a radio
2328
input = document.createElement( "input" );

src/attributes/val.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ jQuery.extend( {
105105
if ( ( option.selected || i === index ) &&
106106

107107
// Don't return options that are disabled or in a disabled optgroup
108-
!option.disabled &&
108+
( support.optDisabled ?
109+
!option.disabled : option.getAttribute( "disabled" ) === null ) &&
109110
( !option.parentNode.disabled ||
110111
!jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
111112

src/css.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,16 @@ jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
428428
}
429429
);
430430

431+
// Support: Android 2.3
432+
jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
433+
function( elem, computed ) {
434+
if ( computed ) {
435+
return swap( elem, { "display": "inline-block" },
436+
curCSS, [ elem, "marginRight" ] );
437+
}
438+
}
439+
);
440+
431441
// These hooks are used by animate to expand properties
432442
jQuery.each( {
433443
margin: "",

src/css/support.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,34 @@ define( [
8484
computeStyleTests();
8585
}
8686
return reliableMarginLeftVal;
87+
},
88+
reliableMarginRight: function() {
89+
90+
// Support: Android 2.3
91+
// Check if div with explicit width and no margin-right incorrectly
92+
// gets computed margin-right based on width of container. (#3333)
93+
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
94+
// This support function is only executed once so no memoizing is needed.
95+
var ret,
96+
marginDiv = div.appendChild( document.createElement( "div" ) );
97+
98+
// Reset CSS: box-sizing; display; margin; border; padding
99+
marginDiv.style.cssText = div.style.cssText =
100+
101+
// Support: Android 2.3
102+
// Vendor-prefix box-sizing
103+
"-webkit-box-sizing:content-box;box-sizing:content-box;" +
104+
"display:block;margin:0;border:0;padding:0";
105+
marginDiv.style.marginRight = marginDiv.style.width = "0";
106+
div.style.width = "1px";
107+
documentElement.appendChild( container );
108+
109+
ret = !parseFloat( window.getComputedStyle( marginDiv ).marginRight );
110+
111+
documentElement.removeChild( container );
112+
div.removeChild( marginDiv );
113+
114+
return ret;
87115
}
88116
} );
89117
} )();

test/unit/support.js

Lines changed: 78 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,13 @@ testIframeWithCallback(
6767
"createHTMLDocument": true,
6868
"focusin": false,
6969
"noCloneChecked": true,
70+
"optDisabled": true,
7071
"optSelected": true,
7172
"pixelMarginRight": true,
7273
"pixelPosition": true,
7374
"radioValue": true,
74-
"reliableMarginLeft": true
75+
"reliableMarginLeft": true,
76+
"reliableMarginLRight": true
7577
};
7678
} else if ( /opera.*version\/12\.1/i.test( userAgent ) ) {
7779
expected = {
@@ -84,11 +86,13 @@ testIframeWithCallback(
8486
"createHTMLDocument": true,
8587
"focusin": false,
8688
"noCloneChecked": true,
89+
"optDisabled": true,
8790
"optSelected": true,
8891
"pixelMarginRight": true,
8992
"pixelPosition": true,
9093
"radioValue": false,
91-
"reliableMarginLeft": false
94+
"reliableMarginLeft": false,
95+
"reliableMarginRight": true
9296
};
9397
} else if ( /(msie 10\.0|trident\/7\.0)/i.test( userAgent ) ) {
9498
expected = {
@@ -101,11 +105,13 @@ testIframeWithCallback(
101105
"createHTMLDocument": true,
102106
"focusin": true,
103107
"noCloneChecked": false,
108+
"optDisabled": true,
104109
"optSelected": false,
105110
"pixelMarginRight": true,
106111
"pixelPosition": true,
107112
"radioValue": false,
108-
"reliableMarginLeft": true
113+
"reliableMarginLeft": true,
114+
"reliableMarginRight": true
109115
};
110116
} else if ( /msie 9\.0/i.test( userAgent ) ) {
111117
expected = {
@@ -118,11 +124,13 @@ testIframeWithCallback(
118124
"createHTMLDocument": true,
119125
"focusin": true,
120126
"noCloneChecked": false,
127+
"optDisabled": true,
121128
"optSelected": false,
122129
"pixelMarginRight": true,
123130
"pixelPosition": true,
124131
"radioValue": false,
125-
"reliableMarginLeft": true
132+
"reliableMarginLeft": true,
133+
"reliableMarginRight": true
126134
};
127135
} else if ( /chrome/i.test( userAgent ) ) {
128136

@@ -138,11 +146,13 @@ testIframeWithCallback(
138146
"createHTMLDocument": true,
139147
"focusin": false,
140148
"noCloneChecked": true,
149+
"optDisabled": true,
141150
"optSelected": true,
142151
"pixelMarginRight": true,
143152
"pixelPosition": true,
144153
"radioValue": true,
145-
"reliableMarginLeft": true
154+
"reliableMarginLeft": true,
155+
"reliableMarginRight": true
146156
};
147157
} else if ( /9\.0(\.\d+|) safari/i.test( userAgent ) ) {
148158
expected = {
@@ -155,11 +165,13 @@ testIframeWithCallback(
155165
"createHTMLDocument": true,
156166
"focusin": false,
157167
"noCloneChecked": true,
168+
"optDisabled": true,
158169
"optSelected": true,
159170
"pixelMarginRight": true,
160171
"pixelPosition": false,
161172
"radioValue": true,
162-
"reliableMarginLeft": true
173+
"reliableMarginLeft": true,
174+
"reliableMarginRight": true
163175
};
164176
} else if ( /8\.0(\.\d+|) safari/i.test( userAgent ) ) {
165177
expected = {
@@ -172,11 +184,32 @@ testIframeWithCallback(
172184
"createHTMLDocument": false,
173185
"focusin": false,
174186
"noCloneChecked": true,
187+
"optDisabled": true,
175188
"optSelected": true,
176189
"pixelMarginRight": true,
177190
"pixelPosition": false,
178191
"radioValue": true,
179-
"reliableMarginLeft": true
192+
"reliableMarginLeft": true,
193+
"reliableMarginRight": true
194+
};
195+
} else if ( /(?:6|7)\.0(\.\d+|) safari/i.test( userAgent ) ) {
196+
expected = {
197+
"ajax": true,
198+
"boxSizingReliable": true,
199+
"checkClone": true,
200+
"checkOn": true,
201+
"clearCloneStyle": true,
202+
"cors": true,
203+
"createHTMLDocument": true,
204+
"focusin": false,
205+
"noCloneChecked": true,
206+
"optDisabled": true,
207+
"optSelected": true,
208+
"pixelMarginRight": true,
209+
"pixelPosition": false,
210+
"radioValue": true,
211+
"reliableMarginLeft": true,
212+
"reliableMarginRight": true
180213
};
181214
} else if ( /5\.1(\.\d+|) safari/i.test( userAgent ) ) {
182215
expected = {
@@ -186,12 +219,15 @@ testIframeWithCallback(
186219
"checkOn": false,
187220
"clearCloneStyle": true,
188221
"cors": true,
189-
"focusinBubbles": false,
222+
"createHTMLDocument": true,
223+
"focusin": false,
190224
"noCloneChecked": true,
191225
"optDisabled": true,
192226
"optSelected": true,
227+
"pixelMarginRight": true,
193228
"pixelPosition": false,
194229
"radioValue": true,
230+
"reliableMarginLeft": true,
195231
"reliableMarginRight": true
196232
};
197233
} else if ( /firefox/i.test( userAgent ) ) {
@@ -205,11 +241,13 @@ testIframeWithCallback(
205241
"createHTMLDocument": true,
206242
"focusin": false,
207243
"noCloneChecked": true,
244+
"optDisabled": true,
208245
"optSelected": true,
209246
"pixelMarginRight": true,
210247
"pixelPosition": true,
211248
"radioValue": true,
212-
"reliableMarginLeft": false
249+
"reliableMarginLeft": false,
250+
"reliableMarginRight": true
213251
};
214252
} else if ( /iphone os 9_/i.test( userAgent ) ) {
215253
expected = {
@@ -222,11 +260,13 @@ testIframeWithCallback(
222260
"createHTMLDocument": true,
223261
"focusin": false,
224262
"noCloneChecked": true,
263+
"optDisabled": true,
225264
"optSelected": true,
226265
"pixelMarginRight": true,
227266
"pixelPosition": false,
228267
"radioValue": true,
229-
"reliableMarginLeft": true
268+
"reliableMarginLeft": true,
269+
"reliableMarginLRight": true
230270
};
231271
} else if ( /iphone os 8_/i.test( userAgent ) ) {
232272
expected = {
@@ -239,11 +279,13 @@ testIframeWithCallback(
239279
"createHTMLDocument": false,
240280
"focusin": false,
241281
"noCloneChecked": true,
282+
"optDisabled": true,
242283
"optSelected": true,
243284
"pixelMarginRight": true,
244285
"pixelPosition": false,
245286
"radioValue": true,
246-
"reliableMarginLeft": true
287+
"reliableMarginLeft": true,
288+
"reliableMarginRight": true
247289
};
248290
} else if ( /iphone os (?:6|7)_/i.test( userAgent ) ) {
249291
expected = {
@@ -256,11 +298,13 @@ testIframeWithCallback(
256298
"createHTMLDocument": true,
257299
"focusin": false,
258300
"noCloneChecked": true,
301+
"optDisabled": true,
259302
"optSelected": true,
260303
"pixelMarginRight": true,
261304
"pixelPosition": false,
262305
"radioValue": true,
263-
"reliableMarginLeft": true
306+
"reliableMarginLeft": true,
307+
"reliableMarginRight": true
264308
};
265309
} else if ( /android 4\.[0-3]/i.test( userAgent ) ) {
266310
expected = {
@@ -273,11 +317,32 @@ testIframeWithCallback(
273317
"createHTMLDocument": true,
274318
"focusin": false,
275319
"noCloneChecked": true,
320+
"optDisabled": true,
276321
"optSelected": true,
277322
"pixelMarginRight": false,
278323
"pixelPosition": false,
279324
"radioValue": true,
280-
"reliableMarginLeft": false
325+
"reliableMarginLeft": false,
326+
"reliableMarginRight": true
327+
};
328+
} else if ( /android 2\.3/i.test( userAgent ) ) {
329+
expected = {
330+
"ajax": true,
331+
"boxSizingReliable": true,
332+
"checkClone": true,
333+
"checkOn": false,
334+
"clearCloneStyle": false,
335+
"cors": true,
336+
"createHTMLDocument": true,
337+
"focusin": false,
338+
"noCloneChecked": true,
339+
"optDisabled": false,
340+
"optSelected": true,
341+
"pixelMarginRight": true,
342+
"pixelPosition": false,
343+
"radioValue": true,
344+
"reliableMarginLeft": false,
345+
"reliableMarginRight": false
281346
};
282347
}
283348

0 commit comments

Comments
 (0)