Misc: Drop support for older browsers; update support comments

That includes Opera 12.x, Firefox<29, Safari<6.0 and some hacks
for old Blackberry.

Closes gh-1820
Refs gh-1815
This commit is contained in:
Michał Gołębiowski 2014-10-27 18:36:07 +01:00
parent 758fd6cea9
commit 740e190223
17 changed files with 56 additions and 141 deletions

View File

@ -9,7 +9,7 @@ define([
input.type = "checkbox";
// Support: iOS<=5.1, Android<=4.2+
// Support: Android<4.4
// Default value for a checkbox should be "on"
support.checkOn = input.value !== "";

View File

@ -250,7 +250,7 @@ jQuery.extend({
if ( obj == null ) {
return obj + "";
}
// Support: Android<4.0, iOS<6 (functionish RegExp)
// Support: Android<4.0 (functionish RegExp)
return typeof obj === "object" || typeof obj === "function" ?
class2type[ toString.call(obj) ] || "object" :
typeof obj;
@ -354,6 +354,8 @@ jQuery.extend({
return arr == null ? -1 : indexOf.call( arr, elem, i );
},
// Support: Android<4.1, PhantomJS<2
// push.apply(_, arraylike) throws on ancient WebKit
merge: function( first, second ) {
var len = +second.length,
j = 0,

View File

@ -69,9 +69,7 @@ var rootjQuery,
} else {
elem = document.getElementById( match[2] );
// Support: Blackberry 4.6
// gEBID returns nodes no longer in the document (#6963)
if ( elem && elem.parentNode ) {
if ( elem ) {
// Inject the element directly into the jQuery object
this.length = 1;
this[0] = elem;

View File

@ -34,7 +34,7 @@ var
fontWeight: "400"
},
cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
cssPrefixes = [ "Webkit", "Moz", "ms" ];
// Return a css property mapped to a potentially vendor prefixed property
function vendorPropName( style, name ) {

View File

@ -7,8 +7,7 @@ define([
], function( jQuery, rnumnonpx, rmargin, getStyles ) {
function curCSS( elem, name, computed ) {
var width, minWidth, maxWidth, ret,
style = elem.style;
var ret;
computed = computed || getStyles( elem );
@ -23,33 +22,10 @@ function curCSS( elem, name, computed ) {
if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
ret = jQuery.style( elem, name );
}
// Support: iOS < 6
// A tribute to the "awesome hack by Dean Edwards"
// iOS < 6 (at least) returns percentage for a larger set of values,
// but width seems to be reliably pixels
// this is against the CSSOM draft spec:
// http://dev.w3.org/csswg/cssom/#resolved-values
if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
// Remember the original values
width = style.width;
minWidth = style.minWidth;
maxWidth = style.maxWidth;
// Put in the new values to get a computed value out
style.minWidth = style.maxWidth = style.width = ret;
ret = computed.width;
// Revert the changed values
style.width = width;
style.minWidth = minWidth;
style.maxWidth = maxWidth;
}
}
return ret !== undefined ?
// Support: IE
// Support: IE9-11+
// IE returns zIndex value as an integer.
ret + "" :
ret;

View File

@ -4,11 +4,9 @@ define([
], function( jQuery ) {
jQuery.expr.filters.hidden = function( elem ) {
// Support: Opera <= 12.12
// Opera reports offsetWidths and offsetHeights less than zero on some elements
// Use OR instead of AND as the element is not visible if either is true
// See tickets #10406 and #13132
return elem.offsetWidth <= 0 || elem.offsetHeight <= 0;
return !elem.offsetWidth || !elem.offsetHeight;
};
jQuery.expr.filters.visible = function( elem ) {
return !jQuery.expr.filters.hidden( elem );

View File

@ -27,10 +27,10 @@ define([
// so they're executed at the same time to save the second computation.
function computePixelPositionAndBoxSizingReliable() {
div.style.cssText =
// Support: Firefox<29, Android 2.3
// Support: Android 2.3
// Vendor-prefix box-sizing
"-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" +
"box-sizing:border-box;display:block;margin-top:1%;top:1%;" +
"-webkit-box-sizing:border-box;box-sizing:border-box;" +
"display:block;margin-top:1%;top:1%;" +
"border:1px;padding:1px;width:4px;position:absolute";
div.innerHTML = "";
docElem.appendChild( container );
@ -72,10 +72,10 @@ define([
// Reset CSS: box-sizing; display; margin; border; padding
marginDiv.style.cssText = div.style.cssText =
// Support: Firefox<29, Android 2.3
// Support: Android 2.3
// Vendor-prefix box-sizing
"-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
"box-sizing:content-box;display:block;margin:0;border:0;padding:0";
"-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";
docElem.appendChild( container );

View File

@ -536,13 +536,7 @@ jQuery.event = {
event[ prop ] = originalEvent[ prop ];
}
// Support: Cordova 2.5 (WebKit) (#13255)
// All events should have a target; Cordova deviceready doesn't
if ( !event.target ) {
event.target = document;
}
// Support: Safari 6.0+, Chrome<28
// Support: Safari 6.0+
// Target should not be a text node (#504, #13143)
if ( event.target.nodeType === 3 ) {
event.target = event.target.parentNode;
@ -709,7 +703,10 @@ jQuery.Event.prototype = {
};
// Create mouseenter/leave events using mouseover/out and event-time checks
// Support: Chrome 15+
// so that event delegation works in jQuery.
// Do the same for pointerenter/pointerleave and pointerover/pointerout
// Support: Safari<7.0
// Safari doesn't support mouseenter/mouseleave at all.
jQuery.each({
mouseenter: "mouseover",
mouseleave: "mouseout",

View File

@ -204,7 +204,7 @@ jQuery.extend({
// Add nodes directly
if ( jQuery.type( elem ) === "object" ) {
// Support: QtWebKit, PhantomJS
// Support: Android<4.1, PhantomJS<2
// push.apply(_, arraylike) throws on ancient WebKit
jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
@ -227,7 +227,7 @@ jQuery.extend({
tmp = tmp.lastChild;
}
// Support: QtWebKit, PhantomJS
// Support: Android<4.1, PhantomJS<2
// push.apply(_, arraylike) throws on ancient WebKit
jQuery.merge( nodes, tmp.childNodes );
@ -514,8 +514,8 @@ jQuery.fn.extend({
// Keep references to cloned scripts for later restoration
if ( hasScripts ) {
// Support: QtWebKit
// jQuery.merge because push.apply(_, arraylike) throws
// Support: Android<4.1, PhantomJS<2
// push.apply(_, arraylike) throws on ancient WebKit
jQuery.merge( scripts, getAll( node, "script" ) );
}
}
@ -572,8 +572,8 @@ jQuery.each({
elems = i === last ? this : this.clone( true );
jQuery( insert[ i ] )[ original ]( elems );
// Support: QtWebKit
// .get() because push.apply(_, arraylike) throws
// Support: Android<4.1, PhantomJS<2
// .get() because push.apply(_, arraylike) throws on ancient WebKit
push.apply( ret, elems.get() );
}

View File

@ -7,17 +7,14 @@ define([
div = fragment.appendChild( document.createElement( "div" ) ),
input = document.createElement( "input" );
// Support: Safari<=5.1
// Check state lost if the name is set (#11217)
// Support: Windows Web Apps (WWA)
// `name` and `type` must use .setAttribute for WWA (#14901)
input.setAttribute( "type", "radio" );
input.setAttribute( "checked", "checked" );
input.setAttribute( "name", "t" );
div.appendChild( input );
// Support: Safari<=5.1, Android<4.2
// Support: Android<4.2
// Older WebKit doesn't clone checked state correctly in fragments
support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;

View File

@ -96,11 +96,7 @@ jQuery.fn.extend({
return box;
}
// Support: BlackBerry 5, iOS 3 (original iPhone)
// If we don't have gBCR, just use 0,0 rather than error
if ( elem.getBoundingClientRect ) {
box = elem.getBoundingClientRect();
}
win = getWindow( doc );
return {
top: box.top + win.pageYOffset - docElem.clientTop,

View File

@ -1019,9 +1019,6 @@ module( "ajax", {
" (no cache)": false
},
function( label, cache ) {
// Support: Opera 12.0
// In Opera 12.0, XHR doesn't notify 304 back to the user properly
var opera = window.opera && window.opera.version();
jQuery.each(
{
"If-Modified-Since": "if_modified_since.php",
@ -1041,15 +1038,9 @@ module( "ajax", {
ifModified: true,
cache: cache,
success: function( data, status, jqXHR ) {
if ( status === "success" && opera === "12.00" ) {
strictEqual( status, "success", "Opera 12.0: Following status is 'success'" );
strictEqual( jqXHR.status, 200, "Opera 12.0: XHR status is 200, not 304" );
strictEqual( data, "", "Opera 12.0: response body is empty" );
} else {
strictEqual( status, "notmodified", "Following status is 'notmodified'" );
strictEqual( jqXHR.status, 304, "XHR status is 304" );
equal( data, null, "no response body is given" );
}
},
complete: function() {
start();

View File

@ -228,8 +228,6 @@ test("css(String, Object)", function() {
j = jQuery("#nonnodes").contents();
j.css("overflow", "visible");
equal( j.css("overflow"), "visible", "Check node,textnode,comment css works" );
// opera sometimes doesn't update 'display' correctly, see #2037
jQuery("#t2037")[0].innerHTML = jQuery("#t2037")[0].innerHTML;
equal( jQuery("#t2037 .hidden").css("display"), "none", "Make sure browser thinks it is hidden" );
div = jQuery("#nothiddendiv");
@ -790,8 +788,8 @@ test("Do not append px (#9548, #12990)", function() {
test("css('width') and css('height') should respect box-sizing, see #11004", function() {
expect( 4 );
// Support: Firefox<29, Android 2.3 (Prefixed box-sizing versions).
var el_dis = jQuery("<div style='width:300px;height:300px;margin:2px;padding:2px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;'>test</div>"),
// Support: Android 2.3 (-webkit-box-sizing).
var el_dis = jQuery("<div style='width:300px;height:300px;margin:2px;padding:2px;-webkit-box-sizing:border-box;box-sizing:border-box;'>test</div>"),
el = el_dis.clone().appendTo("#qunit-fixture");
equal( el.css("width"), el.css("width", el.css("width")).css("width"), "css('width') is not respecting box-sizing, see #11004");

View File

@ -418,8 +418,8 @@ test( "getters on non elements should return null", function() {
test("setters with and without box-sizing:border-box", function(){
expect(20);
// Support: Firefox<29, Android 2.3 (Prefixed box-sizing versions).
var el_bb = jQuery("<div style='width:114px;height:114px;margin:5px;padding:3px;border:4px solid white;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;'>test</div>").appendTo("#qunit-fixture"),
// Support: Android 2.3 (-webkit-box-sizing).
var el_bb = jQuery("<div style='width:114px;height:114px;margin:5px;padding:3px;border:4px solid white;-webkit-box-sizing:border-box;box-sizing:border-box;'>test</div>").appendTo("#qunit-fixture"),
el = jQuery("<div style='width:100px;height:100px;margin:5px;padding:3px;border:4px solid white;'>test</div>").appendTo("#qunit-fixture"),
expected = 100;

View File

@ -1417,7 +1417,7 @@ test("Submit event can be stopped (#11049)", function() {
form.remove();
});
// Test beforeunload event only if it supported (i.e. not Opera)
// Test beforeunload event only if it supported.
// Support: iOS 7+, Android<4.0
// iOS & old Android have the window.onbeforeunload field but don't support the beforeunload
// handler making it impossible to feature-detect the support.
@ -2431,7 +2431,6 @@ testIframeWithCallback( "focusin from an iframe", "event/focusinCrossFrame.html"
var input = jQuery( frameDoc ).find( "#frame-input" );
if ( input.length ) {
// Create a focusin handler on the parent; shouldn't affect the iframe's fate
jQuery ( "body" ).on( "focusin.iframeTest", function() {
ok( false, "fired a focusin event in the parent document" );
@ -2452,11 +2451,6 @@ testIframeWithCallback( "focusin from an iframe", "event/focusinCrossFrame.html"
// Remove body handler manually since it's outside the fixture
jQuery( "body" ).off( "focusin.iframeTest" );
} else {
// Opera 12 (pre-Blink) doesn't select anything
ok( true, "SOFTFAIL: no focus event fired in the iframe" );
}
});
testIframeWithCallback( "jQuery.ready promise", "event/promiseReady.html", function( isOk ) {

View File

@ -110,7 +110,7 @@ test("jQuery.param() Constructed prop values", function() {
});
test("serialize()", function() {
expect(5);
expect(6);
// Add html5 elements only for serialize because selector can't yet find them on non-html5 browsers
jQuery("#search").after(
@ -139,10 +139,8 @@ test("serialize()", function() {
"action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&search=search&email=dave%40jquery.com&number=43&select1=&select2=3&select3=1&select3=2&select5=3&T3=%3F%0D%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=",
"Multiple form serialization as query string");
/* Temporarily disabled. Opera 10 has problems with form serialization.
equal( jQuery("#form, #testForm :input").serialize(),
"action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&search=search&email=dave%40jquery.com&number=43&select1=&select2=3&select3=1&select3=2&T3=%3F%0D%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=",
"action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&search=search&email=dave%40jquery.com&number=43&select1=&select2=3&select3=1&select3=2&select5=3&T3=%3F%0D%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=",
"Mixed form/input serialization as query string");
*/
jQuery("#html5email, #html5number").remove();
});

View File

@ -52,6 +52,8 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
userAgent = window.navigator.userAgent;
if ( /chrome/i.test( userAgent ) ) {
// Catches Chrome on Android as well (i.e. the default
// Android browser on Android >= 4.4).
expected = {
"ajax": true,
"boxSizingReliable": true,
@ -67,22 +69,6 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"radioValue": true,
"reliableMarginRight": true
};
} else if ( /opera.*version\/12\.1/i.test( userAgent ) ) {
expected = {
"ajax": true,
"boxSizingReliable": true,
"checkClone": true,
"checkOn": true,
"clearCloneStyle": true,
"cors": true,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": true,
"optSelected": true,
"pixelPosition": true,
"radioValue": false,
"reliableMarginRight": true
};
} else if ( /trident\/7\.0/i.test( userAgent ) ) {
expected = {
"ajax": true,
@ -163,22 +149,6 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"radioValue": true,
"reliableMarginRight": true
};
} else if ( /5\.1(\.\d+|) safari/i.test( userAgent ) ) {
expected = {
"ajax": true,
"boxSizingReliable": true,
"checkClone": false,
"checkOn": false,
"clearCloneStyle": true,
"cors": true,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": true,
"optSelected": true,
"pixelPosition": false,
"radioValue": true,
"reliableMarginRight": true
};
} else if ( /firefox/i.test( userAgent ) ) {
expected = {
"ajax": true,
@ -195,7 +165,7 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"radioValue": true,
"reliableMarginRight": true
};
} else if ( /iphone os (?:6|7)_/i.test( userAgent ) ) {
} else if ( /iphone os/i.test( userAgent ) ) {
expected = {
"ajax": true,
"boxSizingReliable": true,