Revert "Misc: Drop support for older browsers; update support comments"

This reverts commit 740e190223.
This commit is contained in:
Michał Gołębiowski 2015-11-16 21:25:05 +01:00
parent ae88b3971c
commit 65d71843b7
15 changed files with 93 additions and 33 deletions

View File

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

View File

@ -255,7 +255,7 @@ jQuery.extend( {
return obj + "";
}
// Support: Android<4.0 (functionish RegExp)
// Support: Android<4.0, iOS<6 (functionish RegExp)
return typeof obj === "object" || typeof obj === "function" ?
class2type[ toString.call( obj ) ] || "object" :
typeof obj;
@ -348,8 +348,6 @@ 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

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

View File

@ -36,7 +36,7 @@ var
fontWeight: "400"
},
cssPrefixes = [ "Webkit", "Moz", "ms" ],
cssPrefixes = [ "Webkit", "O", "Moz", "ms" ],
emptyStyle = document.createElement( "div" ).style;
// Return a css property mapped to a potentially vendor prefixed property

View File

@ -5,7 +5,7 @@ define( [
"./var/getStyles",
"./support",
"../selector" // Get jQuery.contains
], function( jQuery, rnumnonpx, rmargin, getStyles, support ) {
], function( jQuery, rnumnonpx, rmargin, getStyles ) {
function curCSS( elem, name, computed ) {
var width, minWidth, maxWidth, ret,
@ -22,12 +22,13 @@ function curCSS( elem, name, computed ) {
ret = jQuery.style( elem, name );
}
// Support: iOS < 6, Android 4.0-4.3 only
// A tribute to the "awesome hack by Dean Edwards"
// Android Browser returns percentage for some values,
// but width seems to be reliably pixels.
// This is against the CSSOM draft spec:
// 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 ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {
if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
// Remember the original values
width = style.width;

View File

@ -4,7 +4,12 @@ define( [
], function( jQuery ) {
jQuery.expr.filters.hidden = function( elem ) {
return !jQuery.expr.filters.visible( 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;
};
jQuery.expr.filters.visible = function( elem ) {
return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );

View File

@ -29,10 +29,12 @@ define( [
// so they're executed at the same time to save the second computation.
function computeStyleTests() {
div.style.cssText =
"box-sizing:border-box;" +
"position:relative;display:block;" +
"margin:auto;border:1px;padding:1px;" +
"top:1%;width:50%";
// Support: Firefox<29, 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%;" +
"border:1px;padding:1px;width:4px;position:absolute";
div.innerHTML = "";
documentElement.appendChild( container );

View File

@ -469,7 +469,13 @@ jQuery.event = {
event[ prop ] = originalEvent[ prop ];
}
// Support: Safari 6-8+
// 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
// Target should not be a text node (#504, #13143)
if ( event.target.nodeType === 3 ) {
event.target = event.target.parentNode;

View File

@ -464,8 +464,8 @@ jQuery.each( {
elems = i === last ? this : this.clone( true );
jQuery( insert[ i ] )[ original ]( elems );
// Support: Android<4.1, PhantomJS<2
// .get() because push.apply(_, arraylike) throws on ancient WebKit
// Support: QtWebKit
// .get() because push.apply(_, arraylike) throws
push.apply( ret, elems.get() );
}

View File

@ -8,7 +8,7 @@ define( [
div = fragment.appendChild( document.createElement( "div" ) ),
input = document.createElement( "input" );
// Support: Android 4.0-4.3
// Support: Android 4.0-4.3, 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)
@ -18,7 +18,7 @@ define( [
div.appendChild( input );
// Support: Android<4.2
// Support: Safari<=5.1, Android<4.2
// Older WebKit doesn't clone checked state correctly in fragments
support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;

View File

@ -98,7 +98,11 @@ 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

@ -293,6 +293,9 @@ QUnit.test( "css(String, Object)", function( assert ) {
j = jQuery( "#nonnodes" ).contents();
j.css( "overflow", "visible" );
assert.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;
assert.equal( jQuery( "#t2037 .hidden" ).css( "display" ), "none", "Make sure browser thinks it is hidden" );
div = jQuery( "#nothiddendiv" );
@ -867,8 +870,8 @@ QUnit.test( "Do not append px (#9548, #12990)", function( assert ) {
QUnit.test( "css('width') and css('height') should respect box-sizing, see #11004", function( assert ) {
assert.expect( 4 );
// 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>" ),
// 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>"),
el = el_dis.clone().appendTo("#qunit-fixture");
assert.equal( el.css( "width" ), el.css( "width", el.css( "width" ) ).css( "width" ), "css('width') is not respecting box-sizing, see #11004" );

View File

@ -409,9 +409,10 @@ QUnit.test( "getters on non elements should return null", function( assert ) {
QUnit.test( "setters with and without box-sizing:border-box", function( assert ) {
assert.expect( 60 );
// Support: Firefox<29, Android 2.3 (Prefixed box-sizing versions).
var parent = jQuery( "#foo" ).css( { width: "200px", height: "200px", "font-size": "16px" } ),
el_bb = jQuery( "<div style='margin:5px;padding:1px;border:2px solid black;box-sizing:border-box;'></div>" ).appendTo( parent ),
el = jQuery( "<div style='margin:5px;padding:1px;border:2px solid black;'></div>" ).appendTo( parent );
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( parent ),
el = jQuery( "<div style='width:100px;height:100px;margin:5px;padding:3px;border:4px solid white;'>test</div>" ).appendTo( parent );
jQuery.each( {
"number": { set: 100, expected: 100 },

View File

@ -1416,7 +1416,7 @@ QUnit.test( "Submit event can be stopped (#11049)", function( assert ) {
form.remove();
} );
// Test beforeunload event only if it supported.
// Test beforeunload event only if it supported (i.e. not Opera)
// 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.
@ -2520,6 +2520,7 @@ testIframeWithCallback(
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() {
assert.ok( false, "fired a focusin event in the parent document" );
@ -2540,8 +2541,12 @@ testIframeWithCallback(
// Remove body handler manually since it's outside the fixture
jQuery( "body" ).off( "focusin.iframeTest" );
} else {
// Opera 12 (pre-Blink) doesn't select anything
assert.ok( true, "SOFTFAIL: no focus event fired in the iframe" );
}
);
});
testIframeWithCallback(
"jQuery.ready promise",

View File

@ -73,6 +73,23 @@ testIframeWithCallback(
"radioValue": true,
"reliableMarginLeft": true
};
} else if ( /opera.*version\/12\.1/i.test( userAgent ) ) {
expected = {
"ajax": true,
"boxSizingReliable": true,
"checkClone": true,
"checkOn": true,
"clearCloneStyle": true,
"cors": true,
"createHTMLDocument": true,
"focusin": false,
"noCloneChecked": true,
"optSelected": true,
"pixelMarginRight": true,
"pixelPosition": true,
"radioValue": false,
"reliableMarginLeft": false
};
} else if ( /(msie 10\.0|trident\/7\.0)/i.test( userAgent ) ) {
expected = {
"ajax": true,
@ -161,6 +178,22 @@ testIframeWithCallback(
"radioValue": true,
"reliableMarginLeft": 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,
@ -212,7 +245,7 @@ testIframeWithCallback(
"radioValue": true,
"reliableMarginLeft": true
};
} else if ( /iphone os 7_/i.test( userAgent ) ) {
} else if ( /iphone os (?:6|7)_/i.test( userAgent ) ) {
expected = {
"ajax": true,
"boxSizingReliable": true,