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 !== "";
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;
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,
} 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;
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
"./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,
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;
], 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 );
// 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 );
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;
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() );
}
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)
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;
return box;
}
- box = elem.getBoundingClientRect();
+ // 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,
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" );
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>" ),
- el = el_dis.clone().appendTo( "#qunit-fixture" );
+ // 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" );
assert.equal( el_dis.css( "width" ), el_dis.css( "width", el_dis.css( "width" ) ).css( "width" ), "css('width') is not respecting box-sizing for disconnected element, see #11004" );
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 },
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.
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() {
+ jQuery ( "body" ).on( "focusin.iframeTest", function() {
assert.ok( false, "fired a focusin event in the parent document" );
- } );
+ });
input.on( "focusin", function() {
assert.ok( true, "fired a focusin event in the iframe" );
- } );
+ });
// Avoid a native event; Chrome can't force focus to another frame
input.trigger( "focusin" );
// 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",
"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,
"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,
"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,