Skip to content

Commit 724f955

Browse files
committed
WIP Core: Drop support for iOS 10 & Firefox 60
1 parent 2fc644c commit 724f955

File tree

6 files changed

+36
-216
lines changed

6 files changed

+36
-216
lines changed

src/css.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@ define( [
1010
"./css/var/swap",
1111
"./css/curCSS",
1212
"./css/adjustCSS",
13-
"./css/addGetHookIf",
1413
"./css/support",
1514
"./css/finalPropName",
1615

1716
"./core/init",
1817
"./core/ready",
1918
"./selector" // contains
2019
], function( jQuery, access, camelCase, rcssNum, rnumnonpx, cssExpand, isAutoPx,
21-
getStyles, swap, curCSS, adjustCSS, addGetHookIf, support, finalPropName ) {
20+
getStyles, swap, curCSS, adjustCSS, support, finalPropName ) {
2221

2322
"use strict";
2423

@@ -367,19 +366,6 @@ jQuery.each( [ "height", "width" ], function( i, dimension ) {
367366
};
368367
} );
369368

370-
jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
371-
function( elem, computed ) {
372-
if ( computed ) {
373-
return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
374-
elem.getBoundingClientRect().left -
375-
swap( elem, { marginLeft: 0 }, function() {
376-
return elem.getBoundingClientRect().left;
377-
} )
378-
) + "px";
379-
}
380-
}
381-
);
382-
383369
// These hooks are used by animate to expand properties
384370
jQuery.each( {
385371
margin: "",

src/css/addGetHookIf.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/css/curCSS.js

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
11
define( [
22
"../core",
33
"../core/isAttached",
4-
"./var/rboxStyle",
5-
"./var/rnumnonpx",
6-
"./var/getStyles",
7-
"./support"
8-
], function( jQuery, isAttached, rboxStyle, rnumnonpx, getStyles, support ) {
4+
"./var/getStyles"
5+
], function( jQuery, isAttached, rboxStyle, getStyles ) {
96

107
"use strict";
118

129
function curCSS( elem, name, computed ) {
13-
var width, minWidth, maxWidth, ret,
14-
15-
// Support: Firefox 51+
16-
// Retrieving style before computed somehow
17-
// fixes an issue with getting wrong values
18-
// on detached elements
19-
style = elem.style;
10+
var ret;
2011

2112
computed = computed || getStyles( elem );
2213

@@ -27,29 +18,6 @@ function curCSS( elem, name, computed ) {
2718
if ( ret === "" && !isAttached( elem ) ) {
2819
ret = jQuery.style( elem, name );
2920
}
30-
31-
// Support: iOS <=10 only
32-
// A tribute to the "awesome hack by Dean Edwards"
33-
// Old WebKit returns percentage for some values,
34-
// but width seems to be reliably pixels.
35-
// This is against the CSSOM draft spec:
36-
// https://drafts.csswg.org/cssom/#resolved-values
37-
if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
38-
39-
// Remember the original values
40-
width = style.width;
41-
minWidth = style.minWidth;
42-
maxWidth = style.maxWidth;
43-
44-
// Put in the new values to get a computed value out
45-
style.minWidth = style.maxWidth = style.width = ret;
46-
ret = computed.width;
47-
48-
// Revert the changed values
49-
style.width = width;
50-
style.minWidth = minWidth;
51-
style.maxWidth = maxWidth;
52-
}
5321
}
5422

5523
return ret !== undefined ?

src/css/support.js

Lines changed: 25 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -9,51 +9,7 @@ define( [
99

1010
( function() {
1111

12-
// Executing both pixelPosition & boxSizingReliable tests require only one layout
13-
// so they're executed at the same time to save the second computation.
14-
function computeStyleTests() {
15-
16-
// This is a singleton, we need to execute it only once
17-
if ( !div ) {
18-
return;
19-
}
20-
21-
container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
22-
"margin-top:1px;padding:0;border:0";
23-
div.style.cssText =
24-
"position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
25-
"margin:auto;border:1px;padding:1px;" +
26-
"width:60%;top:1%";
27-
documentElement.appendChild( container ).appendChild( div );
28-
29-
var divStyle = window.getComputedStyle( div );
30-
pixelPositionVal = divStyle.top !== "1%";
31-
32-
// Support: Android 4.0 - 4.3 only, Firefox <=3 - 60 only
33-
reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
34-
35-
// Support: iOS <=7.0 - 10.3 only
36-
// Some styles come back with percentage values, even though they shouldn't
37-
div.style.right = "60%";
38-
pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
39-
40-
// Support: IE 9 - 11 only
41-
// Detect misreporting of content dimensions for box-sizing:border-box elements
42-
boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
43-
44-
documentElement.removeChild( container );
45-
46-
// Nullify the div so it wouldn't be stored in the memory and
47-
// it will also be a sign that checks already performed
48-
div = null;
49-
}
50-
51-
function roundPixelMeasures( measure ) {
52-
return Math.round( parseFloat( measure ) );
53-
}
54-
55-
var pixelPositionVal, boxSizingReliableVal, pixelBoxStylesVal,
56-
reliableMarginLeftVal,
12+
var boxSizingReliableVal,
5713
container = document.createElement( "div" ),
5814
div = document.createElement( "div" );
5915

@@ -70,20 +26,31 @@ define( [
7026

7127
jQuery.extend( support, {
7228
boxSizingReliable: function() {
73-
computeStyleTests();
29+
30+
// This is a singleton, we need to execute it only once
31+
if ( div ) {
32+
container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
33+
"margin-top:1px;padding:0;border:0";
34+
div.style.cssText =
35+
"position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
36+
"margin:auto;border:1px;padding:1px;" +
37+
"width:60%;top:1%";
38+
documentElement.appendChild( container ).appendChild( div );
39+
40+
var divStyle = window.getComputedStyle( div );
41+
42+
// Support: IE 9 - 11 only
43+
// Detect misreporting of content dimensions for box-sizing:border-box elements
44+
boxSizingReliableVal = Math.round( parseFloat( divStyle.width ) ) === 36;
45+
46+
documentElement.removeChild( container );
47+
48+
// Nullify the div so it wouldn't be stored in the memory and
49+
// it will also be a sign that checks already performed
50+
div = null;
51+
}
52+
7453
return boxSizingReliableVal;
75-
},
76-
pixelBoxStyles: function() {
77-
computeStyleTests();
78-
return pixelBoxStylesVal;
79-
},
80-
pixelPosition: function() {
81-
computeStyleTests();
82-
return pixelPositionVal;
83-
},
84-
reliableMarginLeft: function() {
85-
computeStyleTests();
86-
return reliableMarginLeftVal;
8754
}
8855
} );
8956
} )();

src/offset.js

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@ define( [
55
"./var/documentElement",
66
"./css/var/rnumnonpx",
77
"./css/curCSS",
8-
"./css/addGetHookIf",
98
"./css/support",
109
"./var/isWindow",
1110
"./core/init",
1211
"./css",
1312
"./selector" // contains
1413
], function( jQuery, access, document, documentElement, rnumnonpx,
15-
curCSS, addGetHookIf, support, isWindow ) {
14+
curCSS, support, isWindow ) {
1615

1716
"use strict";
1817

@@ -207,25 +206,5 @@ jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function(
207206
};
208207
} );
209208

210-
// Support: iOS <=7.0 - 10.3 only
211-
// Add the top/left cssHooks using jQuery.fn.position
212-
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
213-
// getComputedStyle returns percent when specified for top/left/bottom/right;
214-
// rather than make the css module depend on the offset module, just check for it here
215-
jQuery.each( [ "top", "left" ], function( i, prop ) {
216-
jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
217-
function( elem, computed ) {
218-
if ( computed ) {
219-
computed = curCSS( elem, prop );
220-
221-
// If curCSS returns percentage, fallback to offset
222-
return rnumnonpx.test( computed ) ?
223-
jQuery( elem ).position()[ prop ] + "px" :
224-
computed;
225-
}
226-
}
227-
);
228-
} );
229-
230209
return jQuery;
231210
} );

test/unit/support.js

Lines changed: 6 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -58,112 +58,58 @@ testIframe(
5858
var expected,
5959
userAgent = window.navigator.userAgent,
6060
expectedMap = {
61-
edge: {
62-
boxSizingReliable: true,
63-
clearCloneStyle: true,
64-
focusin: false,
65-
noCloneChecked: true,
66-
optSelected: true,
67-
pixelBoxStyles: true,
68-
pixelPosition: true,
69-
radioValue: true,
70-
reliableMarginLeft: true
71-
},
7261
ie_11: {
7362
boxSizingReliable: false,
7463
clearCloneStyle: false,
7564
focusin: true,
7665
noCloneChecked: false,
7766
optSelected: false,
78-
pixelBoxStyles: true,
79-
pixelPosition: true,
80-
radioValue: false,
81-
reliableMarginLeft: true
67+
radioValue: false
8268
},
8369
chrome: {
8470
boxSizingReliable: true,
8571
clearCloneStyle: true,
8672
focusin: false,
8773
noCloneChecked: true,
8874
optSelected: true,
89-
pixelBoxStyles: true,
90-
pixelPosition: true,
91-
radioValue: true,
92-
reliableMarginLeft: true
75+
radioValue: true
9376
},
9477
safari: {
9578
boxSizingReliable: true,
9679
clearCloneStyle: true,
9780
focusin: false,
9881
noCloneChecked: true,
9982
optSelected: true,
100-
pixelBoxStyles: true,
101-
pixelPosition: true,
102-
radioValue: true,
103-
reliableMarginLeft: true
83+
radioValue: true
10484
},
10585
firefox: {
10686
boxSizingReliable: true,
10787
clearCloneStyle: true,
10888
focusin: false,
10989
noCloneChecked: true,
11090
optSelected: true,
111-
pixelBoxStyles: true,
112-
pixelPosition: true,
113-
radioValue: true,
114-
reliableMarginLeft: true
115-
},
116-
firefox_60: {
117-
boxSizingReliable: true,
118-
clearCloneStyle: true,
119-
focusin: false,
120-
noCloneChecked: true,
121-
optSelected: true,
122-
pixelBoxStyles: true,
123-
pixelPosition: true,
124-
radioValue: true,
125-
reliableMarginLeft: false
91+
radioValue: true
12692
},
12793
ios: {
12894
boxSizingReliable: true,
12995
clearCloneStyle: true,
13096
focusin: false,
13197
noCloneChecked: true,
13298
optSelected: true,
133-
pixelBoxStyles: true,
134-
pixelPosition: true,
135-
radioValue: true,
136-
reliableMarginLeft: true
137-
},
138-
ios_10: {
139-
boxSizingReliable: true,
140-
clearCloneStyle: true,
141-
focusin: false,
142-
noCloneChecked: true,
143-
optSelected: true,
144-
pixelBoxStyles: false,
145-
pixelPosition: false,
146-
radioValue: true,
147-
reliableMarginLeft: true
99+
radioValue: true
148100
}
149101
};
150102

151-
if ( /edge\//i.test( userAgent ) ) {
152-
expected = expectedMap.edge;
153-
} else if ( document.documentMode ) {
103+
if ( document.documentMode ) {
154104
expected = expectedMap.ie_11;
155105
} else if ( /chrome/i.test( userAgent ) ) {
156106

157107
// Catches Chrome on Android & Opera as well.
158108
expected = expectedMap.chrome;
159109
} else if ( /\b\d+(\.\d+)+ safari/i.test( userAgent ) ) {
160110
expected = expectedMap.safari;
161-
} else if ( /firefox\/60/i.test( userAgent ) ) {
162-
expected = expectedMap.firefox_60;
163111
} else if ( /firefox/i.test( userAgent ) ) {
164112
expected = expectedMap.firefox;
165-
} else if ( /iphone os 10_/i.test( userAgent ) ) {
166-
expected = expectedMap.ios_10;
167113
} else if ( /(?:iphone|ipad);.*(?:iphone)? os \d+_/i.test( userAgent ) ) {
168114
expected = expectedMap.ios;
169115
}

0 commit comments

Comments
 (0)