Misc: Drop support for older browsers; update support comments

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

Fixes gh-1836
Fixes gh-1701
Refs gh-1815
Refs gh-1820
This commit is contained in:
Michał Gołębiowski 2014-11-03 19:53:22 +01:00 committed by Michał Gołębiowski
parent a467f8653a
commit 90d7cc1d8b
41 changed files with 253 additions and 1074 deletions

View File

@ -14,7 +14,7 @@ In the spirit of open source software development, jQuery always encourages comm
Environments in which to use jQuery
--------------------------------------
- [Browser support](http://jquery.com/browser-support/) differs between the master branch and the compat branch. Specifically, the master branch does not support legacy browsers such as IE6-8. The jQuery team continues to provide support for legacy browsers on the compat branch. Use the latest compat release if support for those browsers is required. See [browser support](http://jquery.com/browser-support/) for more info.
- [Browser support](http://jquery.com/browser-support/) differs between the master branch and the compat branch. Specifically, the master branch does not support legacy browsers such as IE8. The jQuery team continues to provide support for legacy browsers on the compat branch. Use the latest compat release if support for those browsers is required. See [browser support](http://jquery.com/browser-support/) for more info.
- To use jQuery in Node, browser extensions, and other non-browser environments, use only master branch releases given the name "jquery" rather than "jquery-compat". The compat branch does not support these environments.

View File

@ -13,7 +13,6 @@
"undef": true,
"unused": true,
"evil": true,
"sub": true,
"es3": true,

View File

@ -10,10 +10,6 @@ define([
], function( jQuery, rnotwhite, nonce, rquery ) {
var
// Document location
ajaxLocParts,
ajaxLocation,
rhash = /#.*$/,
rts = /([?&])_=[^&]*/,
rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
@ -42,23 +38,13 @@ var
transports = {},
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
allTypes = "*/".concat("*");
allTypes = "*/".concat( "*" ),
// Support: IE<8
// #8138, IE may throw an exception when accessing
// a field from window.location if document.domain has been set
try {
ajaxLocation = location.href;
} catch ( e ) {
// Use the href attribute of an A element
// since IE will modify it given document.location
ajaxLocation = document.createElement( "a" );
ajaxLocation.href = "";
ajaxLocation = ajaxLocation.href;
}
// Document location
ajaxLocation = location.href,
// Segment location into parts
ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
// Segment location into parts
ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
function addToPrefiltersOrTransports( structure ) {
@ -79,7 +65,7 @@ function addToPrefiltersOrTransports( structure ) {
// For each dataType in the dataTypeExpression
while ( (dataType = dataTypes[i++]) ) {
// Prepend if requested
if ( dataType.charAt( 0 ) === "+" ) {
if ( dataType[ 0 ] === "+" ) {
dataType = dataType.slice( 1 ) || "*";
(structure[ dataType ] = structure[ dataType ] || []).unshift( func );
@ -509,7 +495,7 @@ jQuery.extend({
jqXHR.error = jqXHR.fail;
// Remove hash character (#7531: and string promotion)
// Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
// Add protocol if not provided (prefilters might expect it)
// Handle falsy url in the settings object (#10093: consistency with old signature)
// We also use the url parameter if available
s.url = ( ( url || s.url || ajaxLocation ) + "" )

View File

@ -2,48 +2,10 @@ define([
"../core"
], function( jQuery ) {
var rvalidtokens = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;
// Support: Android 2.3
// Workaround failure to string-cast null input
jQuery.parseJSON = function( data ) {
// Attempt to parse using the native JSON parser first
if ( window.JSON && window.JSON.parse ) {
// Support: Android 2.3
// Workaround failure to string-cast null input
return window.JSON.parse( data + "" );
}
var requireNonComma,
depth = null,
str = jQuery.trim( data + "" );
// Guard against invalid (and possibly dangerous) input by ensuring that nothing remains
// after removing valid tokens
return str && !jQuery.trim( str.replace( rvalidtokens, function( token, comma, open, close ) {
// Force termination if we see a misplaced comma
if ( requireNonComma && comma ) {
depth = 0;
}
// Perform no more replacements after returning to outermost depth
if ( depth === 0 ) {
return token;
}
// Commas must not follow "[", "{", or ","
requireNonComma = open || comma;
// Determine new depth
// array/object open ("[" or "{"): depth += true - false (increment)
// array/object close ("]" or "}"): depth += false - true (decrement)
// other cases ("," or primitive): depth += true - true (numeric cast)
depth += !close - !open;
// Remove this token
return "";
}) ) ?
( Function( "return " + str ) )() :
jQuery.error( "Invalid JSON: " + data );
return JSON.parse( data + "" );
};
return jQuery.parseJSON;

View File

@ -77,9 +77,8 @@ jQuery.ajaxTransport( "script", function(s) {
}
};
// Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
// Use native DOM manipulation to avoid our domManip AJAX trickery
head.insertBefore( script, head.firstChild );
head.appendChild( script );
},
abort: function() {

View File

@ -7,13 +7,13 @@ define([
// Create the request object
// (This is still attached to ajaxSettings for backward compatibility)
jQuery.ajaxSettings.xhr = window.ActiveXObject !== undefined ?
// Support: IE6+
// Support: IE8
function() {
// XHR cannot access local files, always use ActiveX for that case
return !this.isLocal &&
// Support: IE7-8
// Support: IE<9
// oldIE XHR does not support non-RFC2616 methods (#13240)
// See http://msdn.microsoft.com/en-us/library/ie/ms536648(v=vs.85).aspx
// and http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9
@ -167,10 +167,6 @@ if ( xhrSupported ) {
if ( !options.async ) {
// if we're in sync mode we fire the callback
callback();
} else if ( xhr.readyState === 4 ) {
// (IE6 & IE7) if it's in cache and has been
// retrieved directly we need to fire the callback
setTimeout( callback );
} else {
// Add to the list of active xhr callbacks
xhr.onreadystatechange = xhrCallbacks[ id ] = callback;

View File

@ -7,10 +7,9 @@ define([
"../selector"
], function( jQuery, rnotwhite, access, support ) {
var nodeHook, boolHook,
var boolHook,
attrHandle = jQuery.expr.attrHandle,
ruseDefault = /^(?:checked|selected)$/i,
getSetAttribute = support.getSetAttribute,
getSetInput = support.input;
jQuery.fn.extend({
@ -45,7 +44,7 @@ jQuery.extend({
if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
name = name.toLowerCase();
hooks = jQuery.attrHooks[ name ] ||
( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
}
if ( value !== undefined ) {
@ -88,7 +87,7 @@ jQuery.extend({
// Boolean attributes get special treatment (#10870)
if ( jQuery.expr.match.bool.test( name ) ) {
// Set corresponding property to false
if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
if ( getSetInput || !ruseDefault.test( name ) ) {
elem[ propName ] = false;
// Support: IE<9
// Also clear defaultChecked/defaultSelected (if appropriate)
@ -96,13 +95,9 @@ jQuery.extend({
elem[ jQuery.camelCase( "default-" + name ) ] =
elem[ propName ] = false;
}
// See #9699 for explanation of this approach (setting first, then removal)
} else {
jQuery.attr( elem, name, "" );
}
elem.removeAttribute( getSetAttribute ? name : propName );
elem.removeAttribute( name );
}
}
},
@ -111,7 +106,7 @@ jQuery.extend({
type: {
set: function( elem, value ) {
if ( !support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
// Setting the type on a radio button after the value resets the value in IE6-9
// Setting the type on a radio button after the value resets the value in IE8-9
// Reset value to default in case type is set after value during creation
var val = elem.value;
elem.setAttribute( "type", value );
@ -131,12 +126,12 @@ boolHook = {
if ( value === false ) {
// Remove boolean attributes when set to false
jQuery.removeAttr( elem, name );
} else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
// IE<8 needs the *property* name
elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );
} else if ( getSetInput || !ruseDefault.test( name ) ) {
elem.setAttribute( jQuery.propFix[ name ] || name, name );
// Use defaultChecked and defaultSelected for oldIE
} else {
// Support: IE<9
// Use defaultChecked and defaultSelected for oldIE
elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
}
@ -149,7 +144,7 @@ jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name )
var getter = attrHandle[ name ] || jQuery.find.attr;
attrHandle[ name ] = getSetInput && getSetAttribute || !ruseDefault.test( name ) ?
attrHandle[ name ] = getSetInput || !ruseDefault.test( name ) ?
function( elem, name, isXML ) {
var ret, handle;
if ( !isXML ) {
@ -173,88 +168,17 @@ jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name )
});
// fix oldIE attroperties
if ( !getSetInput || !getSetAttribute ) {
if ( !getSetInput ) {
jQuery.attrHooks.value = {
set: function( elem, value, name ) {
set: function( elem, value ) {
if ( jQuery.nodeName( elem, "input" ) ) {
// Does not return so that setAttribute is also used
elem.defaultValue = value;
} else {
// Use nodeHook if defined (#1954); otherwise setAttribute is fine
return nodeHook && nodeHook.set( elem, value, name );
}
}
};
}
// IE6/7 do not support getting/setting some attributes with get/setAttribute
if ( !getSetAttribute ) {
// Use this for any attribute in IE6/7
// This fixes almost every IE6/7 issue
nodeHook = {
set: function( elem, value, name ) {
// Set the existing or create a new attribute node
var ret = elem.getAttributeNode( name );
if ( !ret ) {
elem.setAttributeNode(
(ret = elem.ownerDocument.createAttribute( name ))
);
}
ret.value = value += "";
// Break association with cloned elements by also using setAttribute (#9646)
if ( name === "value" || value === elem.getAttribute( name ) ) {
return value;
}
}
};
// Some attributes are constructed with empty-string values when not defined
attrHandle.id = attrHandle.name = attrHandle.coords =
function( elem, name, isXML ) {
var ret;
if ( !isXML ) {
return (ret = elem.getAttributeNode( name )) && ret.value !== "" ?
ret.value :
null;
}
};
// Fixing value retrieval on a button requires this module
jQuery.valHooks.button = {
get: function( elem, name ) {
var ret = elem.getAttributeNode( name );
if ( ret && ret.specified ) {
return ret.value;
}
},
set: nodeHook.set
};
// Set contenteditable to false on removals(#10429)
// Setting to empty string throws an error as an invalid value
jQuery.attrHooks.contenteditable = {
set: function( elem, value, name ) {
nodeHook.set( elem, value === "" ? false : value, name );
}
};
// Set width and height to auto instead of 0 on empty string( Bug #8150 )
// This is for removals
jQuery.each([ "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = {
set: function( elem, value ) {
if ( value === "" ) {
elem.setAttribute( name, "auto" );
return value;
}
}
};
});
}
if ( !support.style ) {
jQuery.attrHooks.style = {
get: function( elem ) {

View File

@ -80,22 +80,6 @@ jQuery.extend({
}
});
// Some attributes require a special call on IE
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
if ( !support.hrefNormalized ) {
// href/src property should get the full normalized URL (#10299/#12915)
jQuery.each([ "href", "src" ], function( i, name ) {
jQuery.propHooks[ name ] = {
get: function( elem ) {
return elem.getAttribute( name, 4 );
}
};
});
}
// Support: Safari, IE9+
// mis-reports the default selected property of an option
// Accessing the parent's selectedIndex property fixes it
if ( !support.optSelected ) {
jQuery.propHooks.selected = {
get: function( elem ) {
@ -129,9 +113,4 @@ jQuery.each([
jQuery.propFix[ this.toLowerCase() ] = this;
});
// IE6/7 call enctype encoding
if ( !support.enctype ) {
jQuery.propFix.enctype = "encoding";
}
});

View File

@ -8,8 +8,7 @@ define([
// Setup
div = document.createElement( "div" );
div.setAttribute( "className", "t" );
div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
div.innerHTML = " <link/><a href='/a'>a</a><input type='checkbox'/>";
a = div.getElementsByTagName("a")[ 0 ];
// First batch of tests.
@ -19,28 +18,18 @@ define([
a.style.cssText = "top:1px";
// Test setAttribute on camelCase class.
// If it works, we need attrFixes when doing get/setAttribute (ie6/7)
support.getSetAttribute = div.className !== "t";
// Get the style information from getAttribute
// (IE uses .cssText instead)
support.style = /top/.test( a.getAttribute("style") );
// Make sure that URLs aren't manipulated
// (IE normalizes it by default)
support.hrefNormalized = a.getAttribute("href") === "/a";
// Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
support.checkOn = !!input.value;
// Support: IE8-11+
// Make sure that a selected-by-default option has a working selected property.
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
// (IE defaults to false instead of true if it's in an optgroup)
support.optSelected = opt.selected;
// Tests for enctype support on a form (#6743)
support.enctype = !!document.createElement("form").enctype;
// Make sure that the options inside disabled selects aren't marked as disabled
// (WebKit marks them as disabled)
select.disabled = true;

View File

@ -96,7 +96,8 @@ jQuery.extend({
for ( ; i < max; i++ ) {
option = options[ i ];
// oldIE doesn't update selected after form reset (#2551)
// Support: IE<10
// IE8-9 doesn't update selected after form reset (#2551)
if ( ( option.selected || i === index ) &&
// Don't return options that are disabled or in a disabled optgroup
( support.optDisabled ?
@ -129,24 +130,9 @@ jQuery.extend({
while ( i-- ) {
option = options[ i ];
if ( jQuery.inArray( jQuery.valHooks.option.get( option ), values ) >= 0 ) {
// Support: IE6
// When new option element is added to select box we need to
// force reflow of newly added node in order to workaround delay
// of initialization properties
try {
option.selected = optionSet = true;
} catch ( _ ) {
// Will be executed only in IE6
option.scrollHeight;
}
} else {
option.selected = false;
if ( (option.selected =
jQuery.inArray( jQuery.valHooks.option.get( option ), values ) >= 0) ) {
optionSet = true;
}
}
@ -172,8 +158,6 @@ jQuery.each([ "radio", "checkbox" ], function() {
};
if ( !support.checkOn ) {
jQuery.valHooks[ this ].get = function( elem ) {
// Support: Webkit
// "" is returned instead of "on" if a value isn't specified
return elem.getAttribute("value") === null ? "on" : elem.value;
};
}

View File

@ -285,9 +285,7 @@ jQuery.extend({
script.text = data;
// Support: IE6
// Circumvent bugs with base elements (#2709 and #4378) by prepending
head.insertBefore( script, head.firstChild );
head.appendChild( script );
head.removeChild( script );
},

View File

@ -27,8 +27,8 @@ var rootjQuery,
// Handle HTML strings
if ( typeof selector === "string" ) {
if ( selector.charAt(0) === "<" &&
selector.charAt( selector.length - 1 ) === ">" &&
if ( selector[ 0 ] === "<" &&
selector[ selector.length - 1 ] === ">" &&
selector.length >= 3 ) {
// Assume that strings that start and end with <> are HTML and skip the regex check
@ -73,16 +73,8 @@ var rootjQuery,
} else {
elem = document.getElementById( match[2] );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if ( elem && elem.parentNode ) {
// Handle the case where IE and Opera return items
// by name instead of ID
if ( elem.id !== match[2] ) {
return rootjQuery.find( selector );
}
// Otherwise, we inject the element directly into the jQuery object
if ( elem ) {
// Inject the element directly into the jQuery object
this.length = 1;
this[0] = elem;
}

View File

@ -71,6 +71,7 @@ function detach() {
document.removeEventListener( "DOMContentLoaded", completed, false );
window.removeEventListener( "load", completed, false );
// Support: IE<9
} else {
document.detachEvent( "onreadystatechange", completed );
window.detachEvent( "onload", completed );
@ -114,6 +115,7 @@ jQuery.ready.promise = function( obj ) {
// A fallback to window.onload, that will always work
window.addEventListener( "load", completed, false );
// Support: IE<9
// If IE event model is used
} else {
// Ensure firing before onload, maybe late but safe also for iframes
@ -121,38 +123,12 @@ jQuery.ready.promise = function( obj ) {
// A fallback to window.onload, that will always work
window.attachEvent( "onload", completed );
// If IE and not a frame
// continually check to see if the document is ready
var top = false;
try {
top = window.frameElement == null && document.documentElement;
} catch ( e ) {}
if ( top && top.doScroll ) {
(function doScrollCheck() {
if ( !jQuery.isReady ) {
try {
// Use the trick by Diego Perini
// http://javascript.nwbox.com/IEContentLoaded/
top.doScroll("left");
} catch ( e ) {
return setTimeout( doScrollCheck, 50 );
}
// detach all dom ready events
detach();
// and execute any waiting functions
jQuery.ready();
}
})();
}
}
}
return readyList.promise( obj );
};
// Kick off the DOM ready check even if the user does not
jQuery.ready.promise();
});

View File

@ -38,7 +38,7 @@ var
fontWeight: "400"
},
cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
cssPrefixes = [ "Webkit", "Moz", "ms" ];
// BuildExclude
curCSS = curCSS.curCSS;
@ -52,7 +52,7 @@ function vendorPropName( style, name ) {
}
// check for vendor prefixed names
var capName = name.charAt(0).toUpperCase() + name.slice(1),
var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
origName = name,
i = cssPrefixes.length;
@ -174,8 +174,7 @@ function getWidthOrHeight( elem, name, extra ) {
var valueIsBorderBox = true,
val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
styles = getStyles( elem ),
isBorderBox = support.boxSizing &&
jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
// some non-html elements return undefined for offsetWidth, so check for null/undefined
// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
@ -302,7 +301,7 @@ jQuery.extend({
if ( !hooks || !("set" in hooks) ||
(value = hooks.set( elem, value, extra )) !== undefined ) {
// Support: IE
// Support: IE<9
// Swallow errors from 'invalid' CSS values (#5509)
try {
style[ name ] = value;
@ -380,8 +379,7 @@ jQuery.each([ "height", "width" ], function( i, name ) {
elem,
name,
extra,
support.boxSizing &&
jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
styles
) : 0
);
@ -437,11 +435,10 @@ if ( !support.opacity ) {
};
}
// Support: Android 2.3
jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
function( elem, computed ) {
if ( computed ) {
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
// Work around by temporarily setting element display to inline-block
return jQuery.swap( elem, { "display": "inline-block" },
curCSS, [ elem, "marginRight" ] );
}

View File

@ -36,12 +36,11 @@ if ( window.getComputedStyle ) {
ret = jQuery.style( elem, name );
}
// Support: Android 4.0-4.3
// A tribute to the "awesome hack by Dean Edwards"
// Chrome < 17 and Safari 5.0 uses "computed value"
// instead of "used value" for margin-right
// Safari 5.1.7 (at least) returns percentage for a larger set of values,
// but width seems to be reliably pixels
// this is against the CSSOM draft spec:
// Android Browser returns percentage for some 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 ) ) {
@ -61,7 +60,7 @@ if ( window.getComputedStyle ) {
}
}
// Support: IE
// Support: IE9-11+
// IE returns zIndex value as an integer.
return ret === undefined ?
ret :
@ -115,7 +114,7 @@ if ( window.getComputedStyle ) {
}
}
// Support: IE
// Support: IE<9
// IE returns zIndex value as an integer.
return ret === undefined ?
ret :

View File

@ -6,11 +6,9 @@ define([
], function( jQuery, support ) {
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 ||
(!support.reliableHiddenOffsets() &&
((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
};

View File

@ -33,11 +33,6 @@ define([
div.cloneNode( true ).style.backgroundClip = "";
support.clearCloneStyle = div.style.backgroundClip === "content-box";
// Support: Firefox<29, Android 2.3
// Vendor-prefix box-sizing
support.boxSizing = style.boxSizing === "" || style.MozBoxSizing === "" ||
style.WebkitBoxSizing === "";
jQuery.extend(support, {
reliableHiddenOffsets: function() {
if ( reliableHiddenOffsetsVal == null ) {
@ -71,9 +66,9 @@ define([
function computeStyleTests() {
// Minified: var b,c,d,j
var div, body, container, contents;
var div, container, contents,
body = document.body;
body = document.getElementsByTagName( "body" )[ 0 ];
if ( !body || !body.style ) {
// Test fired too early or in an unsupported environment, exit.
return;
@ -86,10 +81,10 @@ define([
body.appendChild( container ).appendChild( div );
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";
// Support: IE<9
@ -111,10 +106,10 @@ define([
// Reset CSS: box-sizing; display; margin; border; padding
contents.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";
contents.style.marginRight = contents.style.width = "0";
div.style.width = "1px";
@ -124,7 +119,7 @@ define([
div.removeChild( contents );
}
// Support: IE8
// Support: IE<9
// Check if table cells still have offsetWidth/Height when they are set
// to display:none and there are still other visible table cells in a
// table row; if so, offsetWidth/Height are not reliable for use when

View File

@ -29,7 +29,7 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
// whichever is greatest
// unfortunately, this causes bug #3838 in IE6/8 only,
// unfortunately, this causes bug #3838 in IE8 only,
// but there is currently no good, small way to fix it.
return Math.max(
elem.body[ "scroll" + name ], doc[ "scroll" + name ],

27
src/effects.js vendored
View File

@ -4,7 +4,6 @@ define([
"./css/var/cssExpand",
"./css/var/isHidden",
"./css/defaultDisplay",
"./effects/support",
"./core/init",
"./effects/Tween",
@ -12,7 +11,7 @@ define([
"./css",
"./deferred",
"./traversing"
], function( jQuery, pnum, cssExpand, isHidden, defaultDisplay, support ) {
], function( jQuery, pnum, cssExpand, isHidden, defaultDisplay ) {
var
fxNow, timerId,
@ -177,26 +176,17 @@ function defaultPrefilter( elem, props, opts ) {
jQuery._data( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display;
if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) {
// inline-level elements accept inline-block;
// block-level elements need to be inline with layout
if ( !support.inlineBlockNeedsLayout || defaultDisplay( elem.nodeName ) === "inline" ) {
style.display = "inline-block";
} else {
style.zoom = 1;
}
style.display = "inline-block";
}
}
if ( opts.overflow ) {
style.overflow = "hidden";
if ( !support.shrinkWrapBlocks() ) {
anim.always(function() {
style.overflow = opts.overflow[ 0 ];
style.overflowX = opts.overflow[ 1 ];
style.overflowY = opts.overflow[ 2 ];
});
}
anim.always(function() {
style.overflow = opts.overflow[ 0 ];
style.overflowX = opts.overflow[ 1 ];
style.overflowY = opts.overflow[ 2 ];
});
}
// show/hide pass
@ -320,7 +310,8 @@ function Animation( elem, properties, options ) {
}
var currentTime = fxNow || createFxNow(),
remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
// archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
// Support: Android 2.3
// Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
temp = remaining / animation.duration || 0,
percent = 1 - temp,
index = 0,

View File

@ -1,54 +0,0 @@
define([
"../var/support"
], function( support ) {
(function() {
var shrinkWrapBlocksVal;
support.shrinkWrapBlocks = function() {
if ( shrinkWrapBlocksVal != null ) {
return shrinkWrapBlocksVal;
}
// Will be changed later if needed.
shrinkWrapBlocksVal = false;
// Minified: var b,c,d
var div, body, container;
body = document.getElementsByTagName( "body" )[ 0 ];
if ( !body || !body.style ) {
// Test fired too early or in an unsupported environment, exit.
return;
}
// Setup
div = document.createElement( "div" );
container = document.createElement( "div" );
container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
body.appendChild( container ).appendChild( div );
// Support: IE6
// Check if elements with layout shrink-wrap their children
if ( typeof div.style.zoom !== "undefined" ) {
// Reset CSS: box-sizing; display; margin; border
div.style.cssText =
// Support: Firefox<29, 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:1px;width:1px;zoom:1";
div.appendChild( document.createElement( "div" ) ).style.width = "5px";
shrinkWrapBlocksVal = div.offsetWidth !== 3;
}
body.removeChild( container );
return shrinkWrapBlocksVal;
};
})();
return support;
});

View File

@ -340,8 +340,9 @@ jQuery.event = {
jQuery.acceptData( elem ) ) {
// Call a native DOM method on the target with the same name name as the event.
// Can't use an .isFunction() check here because IE6/7 fails that test.
// Don't do default actions on window, that's where global variables be (#6170)
// Support: IE<9
// Can't use an .isFunction() check here because IE8 fails that test.
if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {
// Don't re-trigger an onFOO event when we call its FOO() method
@ -514,7 +515,7 @@ jQuery.event = {
event.target = originalEvent.srcElement || document;
}
// Support: Chrome 23+, Safari?
// Support: Safari 6.0+
// Target should not be a text node (#504, #13143)
if ( event.target.nodeType === 3 ) {
event.target = event.target.parentNode;
@ -677,7 +678,7 @@ jQuery.removeEvent = document.removeEventListener ?
if ( elem.detachEvent ) {
// #8545, #7054, preventing memory leaks for custom events in IE6-8
// #8545, #7054, preventing memory leaks for custom events in IE8
// detachEvent needed property on element, by name of that event,
// to properly expose it to GC
if ( typeof elem[ name ] === "undefined" ) {

View File

@ -36,7 +36,6 @@ var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|" +
rleadingWhitespace = /^\s+/,
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
rtagName = /<([\w:]+)/,
rtbody = /<tbody/i,
rhtml = /<|&#?\w+;/,
rnoInnerhtml = /<(?:script|style|link)/i,
// checked="checked" or checked
@ -56,7 +55,7 @@ var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|" +
col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
// IE8 can't serialize link, script, style, or any html5 (NoScope) tags,
// unless wrapped in a div with non-breaking characters in front of it.
_default: support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ]
},
@ -91,14 +90,6 @@ function getAll( context, tag ) {
found;
}
// Used in buildFragment, fixes the defaultChecked property
function fixDefaultChecked( elem ) {
if ( rcheckableType.test( elem.type ) ) {
elem.defaultChecked = elem.checked;
}
}
// Support: IE<8
// Manipulating tables requires a tbody
function manipulationTarget( elem, content ) {
return jQuery.nodeName( elem, "table" ) &&
@ -175,7 +166,6 @@ function fixCloneNodeIssues( src, dest ) {
nodeName = dest.nodeName.toLowerCase();
// IE6-8 copies events bound via attachEvent when using cloneNode.
if ( !support.noCloneEvent && dest[ jQuery.expando ] ) {
data = jQuery._data( dest );
@ -187,45 +177,26 @@ function fixCloneNodeIssues( src, dest ) {
dest.removeAttribute( jQuery.expando );
}
// Support: IE<9
// IE blanks contents when cloning scripts, and tries to evaluate newly-set text
if ( nodeName === "script" && dest.text !== src.text ) {
disableScript( dest ).text = src.text;
restoreScript( dest );
// IE6-10 improperly clones children of object elements using classid.
// IE10 throws NoModificationAllowedError if parent is null, #12132.
} else if ( nodeName === "object" ) {
if ( dest.parentNode ) {
dest.outerHTML = src.outerHTML;
}
// This path appears unavoidable for IE9. When cloning an object
// element in IE9, the outerHTML strategy above is not sufficient.
// If the src has innerHTML and the destination does not,
// copy the src.innerHTML into the dest.innerHTML. #10324
if ( support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) {
dest.innerHTML = src.innerHTML;
}
// Support: IE<9
// IE8 fails to persist the checked state of a cloned checkbox
// or radio button.
} else if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
// IE6-8 fails to persist the checked state of a cloned checkbox
// or radio button. Worse, IE6-7 fail to give the cloned element
// a checked appearance if the defaultChecked value isn't also set
dest.checked = src.checked;
dest.defaultChecked = dest.checked = src.checked;
// IE6-7 get confused and end up setting the value of a cloned
// checkbox/radio button to an empty string instead of "on"
if ( dest.value !== src.value ) {
dest.value = src.value;
}
// IE6-8 fails to return the selected option to the default selected
// Support: IE<9
// IE8 fails to return the selected option to the default selected
// state when cloning options
} else if ( nodeName === "option" ) {
dest.defaultSelected = dest.selected = src.defaultSelected;
// IE6-8 fails to set the defaultValue to the correct value when
// Support: IE<9
// IE8 fails to set the defaultValue to the correct value when
// cloning other types of input fields
} else if ( nodeName === "input" || nodeName === "textarea" ) {
dest.defaultValue = src.defaultValue;
@ -292,7 +263,7 @@ jQuery.extend({
buildFragment: function( elems, context, scripts, selection ) {
var j, elem, contains,
tmp, tag, tbody, wrap,
tmp, tag, wrap,
l = elems.length,
// Ensure a safe fragment
@ -335,28 +306,6 @@ jQuery.extend({
nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) );
}
// Remove IE's autoinserted <tbody> from table fragments
if ( !support.tbody ) {
// String was a <table>, *may* have spurious <tbody>
elem = tag === "table" && !rtbody.test( elem ) ?
tmp.firstChild :
// String was a bare <thead> or <tfoot>
wrap[1] === "<table>" && !rtbody.test( elem ) ?
tmp :
0;
j = elem && elem.childNodes.length;
while ( j-- ) {
if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) &&
!tbody.childNodes.length ) {
elem.removeChild( tbody );
}
}
}
jQuery.merge( nodes, tmp.childNodes );
// Fix #12392 for WebKit and IE > 9
@ -378,12 +327,6 @@ jQuery.extend({
safe.removeChild( tmp );
}
// Reset defaultChecked for any radios and checkboxes
// about to be appended to the DOM in IE 6/7 (#8060)
if ( !support.appendChecked ) {
jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );
}
i = 0;
while ( (elem = nodes[ i++ ]) ) {
@ -687,6 +630,8 @@ jQuery.fn.extend({
// Keep references to cloned scripts for later restoration
if ( hasScripts ) {
// Support: Android<4.1, PhantomJS<2
// push.apply(_, arraylike) throws on ancient WebKit
jQuery.merge( scripts, getAll( node, "script" ) );
}
}
@ -749,7 +694,8 @@ jQuery.each({
elems = i === last ? this : this.clone(true);
jQuery( insert[i] )[ original ]( elems );
// Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()
// Support: IE<9, Android<4.1, PhantomJS<2
// .get() because push.apply(_, arraylike) throws on ancient WebKit
push.apply( ret, elems.get() );
}

View File

@ -3,21 +3,15 @@ define([
], function( support ) {
(function() {
// Minified: var a,b,c
var input = document.createElement( "input" ),
div = document.createElement( "div" ),
var div = document.createElement( "div" ),
fragment = document.createDocumentFragment();
// Setup
div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
div.innerHTML = " <link/><a href='/a'></a>";
// IE strips leading whitespace when .innerHTML is used
support.leadingWhitespace = div.firstChild.nodeType === 3;
// Make sure that tbody elements aren't automatically inserted
// IE will insert them into empty tables
support.tbody = !div.getElementsByTagName( "tbody" ).length;
// Make sure that link elements get serialized correctly by innerHTML
// This requires a wrapper element in IE
support.htmlSerialize = !!div.getElementsByTagName( "link" ).length;
@ -27,15 +21,8 @@ define([
support.html5Clone =
document.createElement( "nav" ).cloneNode( true ).outerHTML !== "<:nav></:nav>";
// Check if a disconnected checkbox will retain its checked
// value of true after appended to the DOM (IE6/7)
input.type = "checkbox";
input.checked = true;
fragment.appendChild( input );
support.appendChecked = input.checked;
// Make sure textarea (and checkbox) defaultValue is properly cloned
// Support: IE6-IE11+
// Support: IE8-IE11+
div.innerHTML = "<textarea>x</textarea>";
support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
@ -43,8 +30,8 @@ define([
fragment.appendChild( div );
div.innerHTML = "<input type='radio' checked='checked' name='t'/>";
// Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3
// old WebKit doesn't clone checked state correctly in fragments
// Support: Android<4.2
// Older WebKit doesn't clone checked state correctly in fragments
support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
// Support: IE<9

View File

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

View File

@ -15,43 +15,5 @@ for ( i in jQuery( support ) ) {
support.ownLast = i !== "0";
// Note: most support tests are defined in their respective modules.
// false until the test is run
support.inlineBlockNeedsLayout = false;
// Execute ASAP in case we need to set body.style.zoom
jQuery(function() {
// Minified: var a,b,c,d
var val, div, body, container;
body = document.getElementsByTagName( "body" )[ 0 ];
if ( !body || !body.style ) {
// Return for frameset docs that don't have a body
return;
}
// Setup
div = document.createElement( "div" );
container = document.createElement( "div" );
container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
body.appendChild( container ).appendChild( div );
if ( typeof div.style.zoom !== "undefined" ) {
// Support: IE<8
// Check if natively block-level elements act like inline-block
// elements when setting their display to 'inline' and giving
// them layout
div.style.cssText = "display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1";
support.inlineBlockNeedsLayout = val = div.offsetWidth === 3;
if ( val ) {
// Prevent IE 6 from affecting layout for positioned elements #11048
// Prevent IE from shrinking the body in IE 7 mode #12869
// Support: IE<8
body.style.zoom = 1;
}
}
body.removeChild( container );
});
});

View File

@ -5,7 +5,6 @@
<style>
#test {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
width: 100px;
height: 100px;

View File

@ -2,16 +2,6 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr" id="html">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
html {
/**
* we need to null out border-width, because it causes bug #3838
* and until we drop IE6, this test will fail in IE6 if we didn't
* special case this situation.
**/
border-width: 0;
}
</style>
</head>
<body>
<div>

View File

@ -1,23 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr" id="html">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
</style>
</head>
<body>
<div>
<script src="../../jquery.js"></script>
</div>
<script>
jQuery(function() {
window.parent.iframeCallback( jQuery.support.shrinkWrapBlocks() );
});
</script>
</body>
</html>

View File

@ -1,7 +1,7 @@
/* for testing opacity set in styles in IE */
ol#empty {
opacity: 0;
filter:Alpha(opacity=0) progid:DXImageTransform.Microsoft.gradient(startColorStr='#ffff0000', EndColorStr='#ffffffff');
-ms-filter: "Alpha(opacity=0) progid:DXImageTransform.Microsoft.gradient(startColorStr='#ffff0000', EndColorStr='#ffffffff')";
}
div#fx-tests h4 {
@ -47,7 +47,7 @@ div.largeheight {
}
div.largeopacity {
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=100);
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(opacity=100)";
}
div.medwidth {
@ -60,7 +60,7 @@ div.medheight {
div.medopacity {
opacity: 0.5;
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=50);
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(opacity=50)";
}
div.nowidth {
@ -73,7 +73,7 @@ div.noheight {
div.noopacity {
opacity: 0;
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0);
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(opacity=0)";
}
div.hidden {
@ -143,8 +143,8 @@ dfn { display: none; }
/* #9239 Attach a background to the body( avoid crashes in removing the test element in support ) */
body, div { background: url(http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif) no-repeat -1000px 0; }
/* #6652 REMOVE FILTER:ALPHA(OPACITY=100) AFTER ANIMATION */
#t6652 div { filter: alpha(opacity=50); }
/* #6652 Remove -ms-filter: "alpha(opacity=100)" after animation */
#t6652 div { -ms-filter: "alpha(opacity=50)"; }
/* #10501 */
section { background:#f0f; display:block; }

View File

@ -1014,9 +1014,7 @@ module( "ajax", {
" (no cache)": false
},
function( label, cache ) {
var isOpera = !!window.opera;
asyncTest( "jQuery.ajax() - If-Modified-Since support" + label, 3, function() {
asyncTest( "jQuery.ajax() - If-Modified-Since support" + label, 4, function() {
var url = "data/if_modified_since.php?ts=" + ifModifiedNow++;
jQuery.ajax({
@ -1030,33 +1028,15 @@ module( "ajax", {
url: url,
ifModified: true,
cache: cache,
success: function( data, status ) {
if ( data === "FAIL" ) {
ok( isOpera, "Opera is incapable of doing .setRequestHeader('If-Modified-Since')." );
ok( isOpera, "Opera is incapable of doing .setRequestHeader('If-Modified-Since')." );
} else {
strictEqual( status, "notmodified" );
ok( data == null, "response body should be empty" );
}
start();
success: function( data, status, jqXHR ) {
strictEqual( status, "notmodified", "Following status is 'notmodified'" );
strictEqual( jqXHR.status, 304, "XHR status is 304" );
equal( data, null, "no response body is given" );
},
error: function() {
// Do this because opera simply refuses to implement 304 handling :(
// A feature-driven way of detecting this would be appreciated
// See: http://gist.github.com/599419
ok( isOpera, "error" );
ok( isOpera, "error" );
complete: function() {
start();
}
});
},
error: function() {
strictEqual( false, "error" );
// Do this because opera simply refuses to implement 304 handling :(
// A feature-driven way of detecting this would be appreciated
// See: http://gist.github.com/599419
ok( isOpera, "error" );
start();
}
});
});
@ -1076,31 +1056,13 @@ module( "ajax", {
ifModified: true,
cache: cache,
success: function( data, status ) {
if ( data === "FAIL" ) {
ok( isOpera, "Opera is incapable of doing .setRequestHeader('If-None-Match')." );
ok( isOpera, "Opera is incapable of doing .setRequestHeader('If-None-Match')." );
} else {
strictEqual( status, "notmodified" );
ok( data == null, "response body should be empty" );
}
start();
strictEqual( status, "notmodified" );
ok( data == null, "response body should be empty" );
},
error: function() {
// Do this because opera simply refuses to implement 304 handling :(
// A feature-driven way of detecting this would be appreciated
// See: http://gist.github.com/599419
ok( isOpera, "error" );
ok( isOpera, "error" );
complete: function() {
start();
}
});
},
error: function() {
// Do this because opera simply refuses to implement 304 handling :(
// A feature-driven way of detecting this would be appreciated
// See: http://gist.github.com/599419
ok( isOpera, "error" );
start();
}
});
});

View File

@ -46,10 +46,6 @@ test( "jQuery.propFix integrity test", function() {
"contenteditable": "contentEditable"
};
if ( !jQuery.support.enctype ) {
props.enctype = "encoding";
}
deepEqual( props, jQuery.propFix, "jQuery.propFix passes integrity check" );
});
@ -594,8 +590,7 @@ test( "removeAttr(String)", function() {
$first = jQuery("<div Case='mixed'></div>");
equal( $first.attr("Case"), "mixed", "case of attribute doesn't matter" );
$first.removeAttr("Case");
// IE 6/7 return empty string here, not undefined
ok( !$first.attr("Case"), "mixed-case attribute was removed" );
equal( $first.attr("Case"), undefined, "mixed-case attribute was removed" );
});
test( "removeAttr(String) in XML", function() {

View File

@ -231,8 +231,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");
@ -297,11 +295,7 @@ if ( !jQuery.support.opacity ) {
test2 = test.find( "div" ).css( "opacity", 1 );
function hasFilter( elem ) {
var match = rfilter.exec( elem[0].style.cssText );
if ( match ) {
return true;
}
return false;
return !!rfilter.exec( elem[0].style.cssText );
}
expect( 2 );
ok( !hasFilter( test ), "Removed filter attribute on element without filter in stylesheet" );
@ -455,7 +449,7 @@ test("show();", function() {
expect( 18 );
var hiddendiv, div, pass, old, test;
var hiddendiv, div, pass, test;
hiddendiv = jQuery("div.hidden");
equal(jQuery.css( hiddendiv[0], "display"), "none", "hiddendiv is display: none");
@ -478,10 +472,7 @@ test("show();", function() {
ok( pass, "Show" );
// #show-tests * is set display: none in CSS
jQuery("#qunit-fixture").append("<div id='show-tests'><div><p><a href='#'></a></p><code></code><pre></pre><span></span></div><table><thead><tr><th></th></tr></thead><tbody><tr><td></td></tr></tbody></table><ul><li></li></ul></div><table id='test-table'></table>");
old = jQuery("#test-table").show().css("display") !== "table";
jQuery("#test-table").remove();
jQuery("#qunit-fixture").append("<div id='show-tests'><div><p><a href='#'></a></p><code></code><pre></pre><span></span></div><table><thead><tr><th></th></tr></thead><tbody><tr><td></td></tr></tbody></table><ul><li></li></ul></div>");
test = {
"div" : "block",
@ -490,14 +481,14 @@ test("show();", function() {
"code" : "inline",
"pre" : "block",
"span" : "inline",
"table" : old ? "block" : "table",
"thead" : old ? "block" : "table-header-group",
"tbody" : old ? "block" : "table-row-group",
"tr" : old ? "block" : "table-row",
"th" : old ? "block" : "table-cell",
"td" : old ? "block" : "table-cell",
"table" : "table",
"thead" : "table-header-group",
"tbody" : "table-row-group",
"tr" : "table-row",
"th" : "table-cell",
"td" : "table-cell",
"ul" : "block",
"li" : old ? "block" : "list-item"
"li" : "list-item"
};
jQuery.each(test, function(selector, expected) {
@ -848,8 +839,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;-moz-box-sizing:border-box;-webkit-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");
@ -930,13 +921,13 @@ test( "css opacity consistency across browsers (#12685)", function() {
fixture = jQuery("#qunit-fixture");
// Append style element
jQuery("<style>.opacityWithSpaces_t12685 { opacity: 0.1; filter: alpha(opacity = 10); } .opacityNoSpaces_t12685 { opacity: 0.2; filter: alpha(opacity=20); }</style>").appendTo( fixture );
jQuery("<style>.opacityWithSpaces_t12685 { opacity: 0.1; -ms-filter: 'alpha(opacity = 10)'; } .opacityNoSpaces_t12685 { opacity: 0.2; -ms-filter: 'alpha(opacity=20)'; }</style>").appendTo( fixture );
el = jQuery("<div class='opacityWithSpaces_t12685'></div>").appendTo(fixture);
equal( Math.round( el.css("opacity") * 100 ), 10, "opacity from style sheet (filter:alpha with spaces)" );
equal( Math.round( el.css("opacity") * 100 ), 10, "opacity from style sheet (-ms-filter:alpha with spaces)" );
el.removeClass("opacityWithSpaces_t12685").addClass("opacityNoSpaces_t12685");
equal( Math.round( el.css("opacity") * 100 ), 20, "opacity from style sheet (filter:alpha without spaces)" );
equal( Math.round( el.css("opacity") * 100 ), 20, "opacity from style sheet (-ms-filter:alpha without spaces)" );
el.css( "opacity", 0.3 );
equal( Math.round( el.css("opacity") * 100 ), 30, "override opacity" );
el.css( "opacity", "" );

View File

@ -415,8 +415,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;-moz-box-sizing:border-box;-webkit-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;

151
test/unit/effects.js vendored
View File

@ -47,7 +47,7 @@ test("show() basic", 2, function() {
});
test("show()", 27, function () {
var div, speeds, old, test,
var div, speeds, test,
displaysActual, displaysExpected,
hiddendiv = jQuery("div.hidden");
@ -97,10 +97,7 @@ test("show()", 27, function () {
QUnit.expectJqData( this, div, "olddisplay" );
// #show-tests * is set display: none in CSS
jQuery("#qunit-fixture").append("<div id='show-tests'><div><p><a href='#'></a></p><code></code><pre></pre><span></span></div><table><thead><tr><th></th></tr></thead><tbody><tr><td></td></tr></tbody></table><ul><li></li></ul></div><table id='test-table'></table>");
old = jQuery("#test-table").show().css("display") !== "table";
jQuery("#test-table").remove();
jQuery("#qunit-fixture").append("<div id='show-tests'><div><p><a href='#'></a></p><code></code><pre></pre><span></span></div><table><thead><tr><th></th></tr></thead><tbody><tr><td></td></tr></tbody></table><ul><li></li></ul></div>");
test = {
"div" : "block",
@ -109,14 +106,14 @@ test("show()", 27, function () {
"code" : "inline",
"pre" : "block",
"span" : "inline",
"table" : old ? "block" : "table",
"thead" : old ? "block" : "table-header-group",
"tbody" : old ? "block" : "table-row-group",
"tr" : old ? "block" : "table-row",
"th" : old ? "block" : "table-cell",
"td" : old ? "block" : "table-cell",
"table" : "table",
"thead" : "table-header-group",
"tbody" : "table-row-group",
"tr" : "table-row",
"th" : "table-cell",
"td" : "table-cell",
"ul" : "block",
"li" : old ? "block" : "list-item"
"li" : "list-item"
};
jQuery.each(test, function(selector, expected) {
@ -136,31 +133,27 @@ test("show(Number) - other displays", function() {
// #show-tests * is set display: none in CSS
jQuery("#qunit-fixture").append("<div id='show-tests'><div><p><a href='#'></a></p><code></code><pre></pre><span></span></div><table><thead><tr><th></th></tr></thead><tbody><tr><td></td></tr></tbody></table><ul><li></li></ul></div><table id='test-table'></table>");
var test,
old = jQuery("#test-table").show().css("display") !== "table";
jQuery("#test-table").remove();
jQuery("#qunit-fixture").append("<div id='show-tests'><div><p><a href='#'></a></p><code></code><pre></pre><span></span></div><table><thead><tr><th></th></tr></thead><tbody><tr><td></td></tr></tbody></table><ul><li></li></ul></div>");
// Note: inline elements are expected to be inline-block
// because we're showing width/height
// Can't animate width/height inline
// See #14344
test = {
var test = {
"div" : "block",
"p" : "block",
"a" : "inline-block",
"code" : "inline-block",
"pre" : "block",
"span" : "inline-block",
"table" : old ? "block" : "table",
"thead" : old ? "block" : "table-header-group",
"tbody" : old ? "block" : "table-row-group",
"tr" : old ? "block" : "table-row",
"th" : old ? "block" : "table-cell",
"td" : old ? "block" : "table-cell",
"table" : "table",
"thead" : "table-header-group",
"tbody" : "table-row-group",
"tr" : "table-row",
"th" : "table-cell",
"td" : "table-cell",
"ul" : "block",
"li" : old ? "block" : "list-item"
"li" : "list-item"
};
jQuery.each(test, function(selector, expected) {
@ -289,52 +282,35 @@ test("animate negative padding", function() {
test("animate block as inline width/height", function() {
expect(3);
var span = jQuery("<span>").css("display", "inline-block").appendTo("body"),
expected = span.css("display");
var span = jQuery("<span>").css("display", "inline-block").appendTo("body");
span.remove();
if ( jQuery.support.inlineBlockNeedsLayout || expected === "inline-block" ) {
jQuery("#foo").css({ display: "inline", width: "", height: "" }).animate({ width: 42, height: 42 }, 100, function() {
equal( jQuery(this).css("display"), "inline-block", "inline-block was set on non-floated inline element when animating width/height" );
equal( this.offsetWidth, 42, "width was animated" );
equal( this.offsetHeight, 42, "height was animated" );
});
jQuery("#foo").css({ display: "inline", width: "", height: "" }).animate({ width: 42, height: 42 }, 100, function() {
equal( jQuery(this).css("display"), jQuery.support.inlineBlockNeedsLayout ? "inline" : "inline-block", "inline-block was set on non-floated inline element when animating width/height" );
equal( this.offsetWidth, 42, "width was animated" );
equal( this.offsetHeight, 42, "height was animated" );
});
// Browser doesn't support inline-block
} else {
ok( true, "Browser doesn't support inline-block" );
ok( true, "Browser doesn't support inline-block" );
ok( true, "Browser doesn't support inline-block" );
}
this.clock.tick( 100 );
});
test("animate native inline width/height", function() {
expect(3);
var span = jQuery("<span>").css("display", "inline-block").appendTo("body"),
expected = span.css("display");
var span = jQuery("<span>").css("display", "inline-block").appendTo("body");
span.remove();
if ( jQuery.support.inlineBlockNeedsLayout || expected === "inline-block" ) {
jQuery("#foo").css({ display: "", width: "", height: "" })
.append("<span>text</span>")
.children("span")
.animate({ width: 42, height: 42 }, 100, function() {
equal( jQuery(this).css("display"), "inline-block", "inline-block was set on non-floated inline element when animating width/height" );
equal( this.offsetWidth, 42, "width was animated" );
equal( this.offsetHeight, 42, "height was animated" );
});
jQuery("#foo").css({ display: "", width: "", height: "" })
.append("<span>text</span>")
.children("span")
.animate({ width: 42, height: 42 }, 100, function() {
equal( jQuery(this).css("display"), "inline-block", "inline-block was set on non-floated inline element when animating width/height" );
equal( this.offsetWidth, 42, "width was animated" );
equal( this.offsetHeight, 42, "height was animated" );
});
// Browser doesn't support inline-block
} else {
ok( true, "Browser doesn't support inline-block" );
ok( true, "Browser doesn't support inline-block" );
ok( true, "Browser doesn't support inline-block" );
}
this.clock.tick( 100 );
});
@ -365,30 +341,24 @@ test( "animate block width/height", function() {
this.clock.tick( 100 );
});
test("animate table width/height", function() {
test( "animate table width/height", function() {
expect(1);
var displayMode = jQuery("#table").css("display") !== "table" ? "block" : "table";
jQuery("#table").animate({ width: 42, height: 42 }, 100, function() {
equal( jQuery(this).css("display"), displayMode, "display mode is correct" );
jQuery( "#table" ).animate({ width: 42, height: 42 }, 100, function() {
equal( jQuery( this ).css( "display" ), "table", "display mode is correct" );
});
this.clock.tick( 100 );
});
test("animate table-row width/height", function() {
expect(3);
var displayMode,
tr = jQuery("#table")
var tr = jQuery("#table")
.attr({ "cellspacing": 0, "cellpadding": 0, "border": 0 })
.html("<tr style='height:42px;'><td style='padding:0;'><div style='width:20px;height:20px;'></div></td></tr>")
.find("tr");
// IE<8 uses "block" instead of the correct display type
displayMode = tr.css("display") !== "table-row" ? "block" : "table-row";
tr.animate({ width: 10, height: 10 }, 100, function() {
equal( jQuery(this).css("display"), displayMode, "display mode is correct" );
equal( jQuery( this ).css( "display" ), "table-row", "display mode is correct" );
equal( this.offsetWidth, 20, "width animated to shrink wrap point" );
equal( this.offsetHeight, 20, "height animated to shrink wrap point" );
});
@ -398,17 +368,13 @@ test("animate table-row width/height", function() {
test("animate table-cell width/height", function() {
expect(3);
var displayMode,
td = jQuery( "#table" )
var td = jQuery( "#table" )
.attr({ "cellspacing": 0, "cellpadding": 0, "border": 0 })
.html( "<tr><td style='width:42px;height:42px;padding:0;'><div style='width:20px;height:20px;'></div></td></tr>" )
.find( "td" );
// IE<8 uses "block" instead of the correct display type
displayMode = td.css( "display" ) !== "table-cell" ? "block" : "table-cell";
td.animate({ width: 10, height: 10 }, 100, function() {
equal( jQuery(this).css("display"), displayMode, "display mode is correct" );
equal( jQuery( this ).css( "display" ), "table-cell", "display mode is correct" );
equal( this.offsetWidth, 20, "width animated to shrink wrap point" );
equal( this.offsetHeight, 20, "height animated to shrink wrap point" );
});
@ -1050,11 +1016,10 @@ jQuery.each({
test("Effects chaining", function() {
var remaining = 16,
shrinkwrap = jQuery.support.shrinkWrapBlocks(),
props = [ "opacity", "height", "width", "display", "overflow" ],
setup = function( name, selector, hiddenOverflow ) {
setup = function( name, selector ) {
var $el = jQuery( selector );
return $el.data( getProps( $el[0], hiddenOverflow ) ).data( "name", name );
return $el.data( getProps( $el[0] ) ).data( "name", name );
},
assert = function() {
var data = jQuery.data( this ),
@ -1075,21 +1040,19 @@ test("Effects chaining", function() {
expect( remaining );
// We need to pass jQuery.support.shrinkWrapBlocks for all methods that
// set overflow hidden (slide* and show/hide with speed)
setup( ".fadeOut().fadeIn()", "#fadein div" ).fadeOut("fast").fadeIn( "fast", assert );
setup( ".fadeIn().fadeOut()", "#fadeout div" ).fadeIn("fast").fadeOut( "fast", assert );
setup( ".hide().show()", "#show div", shrinkwrap ).hide("fast").show( "fast", assert );
setup( ".show().hide()", "#hide div", shrinkwrap ).show("fast").hide( "fast", assert );
setup( ".show().hide(easing)", "#easehide div", shrinkwrap ).show("fast").hide( "fast", "linear", assert );
setup( ".toggle().toggle() - in", "#togglein div", shrinkwrap ).toggle("fast").toggle( "fast", assert );
setup( ".toggle().toggle() - out", "#toggleout div", shrinkwrap ).toggle("fast").toggle( "fast", assert );
setup( ".toggle().toggle(easing) - out", "#easetoggleout div", shrinkwrap ).toggle("fast").toggle( "fast", "linear", assert );
setup( ".slideDown().slideUp()", "#slidedown div", shrinkwrap ).slideDown("fast").slideUp( "fast", assert );
setup( ".slideUp().slideDown()", "#slideup div", shrinkwrap ).slideUp("fast").slideDown( "fast", assert );
setup( ".slideUp().slideDown(easing)", "#easeslideup div", shrinkwrap ).slideUp("fast").slideDown( "fast", "linear", assert );
setup( ".slideToggle().slideToggle() - in", "#slidetogglein div", shrinkwrap ).slideToggle("fast").slideToggle( "fast", assert );
setup( ".slideToggle().slideToggle() - out", "#slidetoggleout div", shrinkwrap ).slideToggle("fast").slideToggle( "fast", assert );
setup( ".hide().show()", "#show div" ).hide("fast").show( "fast", assert );
setup( ".show().hide()", "#hide div" ).show("fast").hide( "fast", assert );
setup( ".show().hide(easing)", "#easehide div" ).show("fast").hide( "fast", "linear", assert );
setup( ".toggle().toggle() - in", "#togglein div" ).toggle("fast").toggle( "fast", assert );
setup( ".toggle().toggle() - out", "#toggleout div" ).toggle("fast").toggle( "fast", assert );
setup( ".toggle().toggle(easing) - out", "#easetoggleout div" ).toggle("fast").toggle( "fast", "linear", assert );
setup( ".slideDown().slideUp()", "#slidedown div" ).slideDown("fast").slideUp( "fast", assert );
setup( ".slideUp().slideDown()", "#slideup div" ).slideUp("fast").slideDown( "fast", assert );
setup( ".slideUp().slideDown(easing)", "#easeslideup div" ).slideUp("fast").slideDown( "fast", "linear", assert );
setup( ".slideToggle().slideToggle() - in", "#slidetogglein div" ).slideToggle("fast").slideToggle( "fast", assert );
setup( ".slideToggle().slideToggle() - out", "#slidetoggleout div" ).slideToggle("fast").slideToggle( "fast", assert );
setup( ".fadeToggle().fadeToggle() - in", "#fadetogglein div" ).fadeToggle("fast").fadeToggle( "fast", assert );
setup( ".fadeToggle().fadeToggle() - out", "#fadetoggleout div" ).fadeToggle("fast").fadeToggle( "fast", assert );
setup( ".fadeTo(0.5).fadeTo(1.0, easing)", "#fadeto div" ).fadeTo( "fast", 0.5 ).fadeTo( "fast", 1.0, "linear", assert );
@ -1912,12 +1875,8 @@ test( "Animate properly sets overflow hidden when animating width/height (#12117
equal( div.css( "overflow" ), "hidden",
"overflow: hidden set when animating " + prop + " to " + value );
div.stop();
if ( jQuery.support.shrinkWrapBlocks ) {
ok( true, "cannot restore overflow, shrinkWrapBlocks" );
} else {
equal( div.css( "overflow" ), "auto",
"overflow: auto restored after animating " + prop + " to " + value );
}
equal( div.css( "overflow" ), "auto",
"overflow: auto restored after animating " + prop + " to " + value );
});
});
});

View File

@ -408,15 +408,7 @@ test("on bubbling, isDefaultPrevented, stopImmediatePropagation", function() {
e.preventDefault();
});
$main.on("click", "#foo", function(e) {
var orig = e.originalEvent;
if ( typeof(orig.defaultPrevented) === "boolean" || typeof(orig.returnValue) === "boolean" || orig["getPreventDefault"] ) {
equal( e.isDefaultPrevented(), true, "isDefaultPrevented true passed to bubbled event" );
} else {
// Opera < 11 doesn't implement any interface we can use, so give it a pass
ok( true, "isDefaultPrevented not supported by this browser, test skipped" );
}
equal( e.isDefaultPrevented(), true, "isDefaultPrevented true passed to bubbled event" );
});
fakeClick( $anchor2 );
$anchor2.off( "click" );
@ -1432,7 +1424,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.
@ -1440,7 +1432,6 @@ if ( window.onbeforeunload === null &&
!/(ipad|iphone|ipod|android 2\.3)/i.test( navigator.userAgent ) ) {
asyncTest("on(beforeunload)", 4, function() {
var win,
forIE6 = 0,
fired = false,
iframe = jQuery("<iframe src='data/iframe.html' />");
@ -1454,33 +1445,7 @@ if ( window.onbeforeunload === null &&
strictEqual( win.onbeforeunload, null, "onbeforeunload property on window object still equals null" );
// In old Safari beforeunload event will not fire on iframes
jQuery( win ).on( "unload", function() {
if ( !fired ) {
ok( true, "This is suppose to be true only in old Safari" );
checker();
}
});
jQuery( win ).on( "beforeunload", function() {
// On iframe in IE6 beforeunload event will not fire if event is binded through window object,
// nevertheless, test should continue
window.setTimeout(function() {
if ( !forIE6 ) {
checker();
}
});
});
win.onbeforeunload = function() {
if ( !forIE6 ) {
forIE6++;
checker();
}
};
function checker() {
ok( true, "window.onbeforeunload handler is called" );
iframe = jQuery("<iframe src='data/iframe.html' />");
@ -1503,7 +1468,7 @@ if ( window.onbeforeunload === null &&
win.location.reload();
});
}
};
win.location.reload();
});
@ -2519,32 +2484,26 @@ 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" );
});
// 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" );
});
input.on( "focusin", function() {
ok( true, "fired a focusin event in the iframe" );
});
input.on( "focusin", function() {
ok( true, "fired a focusin event in the iframe" );
});
// Avoid a native event; Chrome can't force focus to another frame
input.trigger( "focusin" );
// Avoid a native event; Chrome can't force focus to another frame
input.trigger( "focusin" );
// Must manually remove handler to avoid leaks in our data store
input.remove();
// Must manually remove handler to avoid leaks in our data store
input.remove();
// Be sure it was removed; nothing should happen
input.trigger( "focusin" );
// Be sure it was removed; nothing should happen
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
ok( true, "SOFTFAIL: no focus event fired in the iframe" );
}
// Remove body handler manually since it's outside the fixture
jQuery( "body" ).off( "focusin.iframeTest" );
});
testIframeWithCallback( "jQuery.ready promise", "event/promiseReady.html", function( isOk ) {
@ -2749,7 +2708,8 @@ if ( !(/firefox/i.test( window.navigator.userAgent )) ) {
$text = jQuery("#text1"),
$radio = jQuery("#radio1").trigger("focus");
// IE6-10 fire focus/blur events asynchronously; this is the resulting mess.
// Support: IE<11
// IE8-10 fire focus/blur events asynchronously; this is the resulting mess.
// IE's browser window must be topmost for this to work properly!!
stop();
$radio[0].focus();

View File

@ -77,8 +77,7 @@ function testText( valueObj ) {
equal( jQuery( j[ 0 ] ).text(), "hi!", "Check node,textnode,comment with text()" );
equal( j[ 1 ].nodeValue, " there ", "Check node,textnode,comment with text()" );
// Blackberry 4.6 doesn't maintain comments in the DOM
equal( jQuery("#nonnodes")[ 0 ].childNodes.length < 3 ? 8 : j[ 2 ].nodeType, 8, "Check node,textnode,comment with text()" );
equal( j[ 2 ].nodeType, 8, "Check node,textnode,comment with text()" );
// Update multiple elements #11809
expected = "New";

View File

@ -182,16 +182,13 @@ testIframe("offset/absolute", "absolute", function( $ ) {
testIframe("offset/relative", "relative", function( $ ) {
expect(60);
var ie, tests;
// IE is collapsing the top margin of 1px; detect and adjust accordingly
ie = $("#relative-1").offset().top === 6;
var tests;
// get offset
tests = [
{ "id": "#relative-1", "top": ie ? 6 : 7, "left": 7 },
{ "id": "#relative-1-1", "top": ie ? 13 : 15, "left": 15 },
{ "id": "#relative-2", "top": ie ? 141 : 142, "left": 27 }
{ "id": "#relative-1", "top": 7, "left": 7 },
{ "id": "#relative-1-1", "top": 15, "left": 15 },
{ "id": "#relative-2", "top": 142, "left": 27 }
];
jQuery.each( tests, function() {
equal( $( this["id"] ).offset().top, this["top"], "jQuery('" + this["id"] + "').offset().top" );
@ -201,9 +198,9 @@ testIframe("offset/relative", "relative", function( $ ) {
// get position
tests = [
{ "id": "#relative-1", "top": ie ? 5 : 6, "left": 6 },
{ "id": "#relative-1-1", "top": ie ? 4 : 5, "left": 5 },
{ "id": "#relative-2", "top": ie ? 140 : 141, "left": 26 }
{ "id": "#relative-1", "top": 6, "left": 6 },
{ "id": "#relative-1-1", "top": 5, "left": 5 },
{ "id": "#relative-2", "top": 141, "left": 26 }
];
jQuery.each( tests, function() {
equal( $( this["id"] ).position().top, this["top"], "jQuery('" + this["id"] + "').position().top" );
@ -245,17 +242,14 @@ testIframe("offset/relative", "relative", function( $ ) {
testIframe("offset/static", "static", function( $ ) {
expect( 80 );
var ie, tests;
// IE is collapsing the top margin of 1px; detect and adjust accordingly
ie = $("#static-1").offset().top === 6;
var tests;
// get offset
tests = [
{ "id": "#static-1", "top": ie ? 6 : 7, "left": 7 },
{ "id": "#static-1-1", "top": ie ? 13 : 15, "left": 15 },
{ "id": "#static-1-1-1", "top": ie ? 20 : 23, "left": 23 },
{ "id": "#static-2", "top": ie ? 121 : 122, left: 7 }
{ "id": "#static-1", "top": 7, "left": 7 },
{ "id": "#static-1-1", "top": 15, "left": 15 },
{ "id": "#static-1-1-1", "top": 23, "left": 23 },
{ "id": "#static-2", "top": 122, left: 7 }
];
jQuery.each( tests, function() {
equal( $( this["id"] ).offset().top, this["top"], "jQuery('" + this["id"] + "').offset().top" );
@ -265,10 +259,10 @@ testIframe("offset/static", "static", function( $ ) {
// get position
tests = [
{ "id": "#static-1", "top": ie ? 5 : 6, "left": 6 },
{ "id": "#static-1-1", "top": ie ? 12 : 14, "left": 14 },
{ "id": "#static-1-1-1", "top": ie ? 19 : 22, "left": 22 },
{ "id": "#static-2", "top": ie ? 120 : 121, "left": 6 }
{ "id": "#static-1", "top": 6, "left": 6 },
{ "id": "#static-1-1", "top": 14, "left": 14 },
{ "id": "#static-1-1-1", "top": 22, "left": 22 },
{ "id": "#static-2", "top": 121, "left": 6 }
];
jQuery.each( tests, function() {
equal( $( this["id"] ).position().top, this["top"], "jQuery('" + this["top"] + "').position().top" );
@ -314,25 +308,22 @@ testIframe("offset/static", "static", function( $ ) {
testIframe("offset/fixed", "fixed", function( $ ) {
expect(34);
var ie, tests, $noTopLeft;
// IE is collapsing the top margin of 1px; detect and adjust accordingly
ie = $("#fixed-1").position().top === 2;
var tests, $noTopLeft;
tests = [
{
"id": "#fixed-1",
"offsetTop": 1001,
"offsetLeft": 1001,
"positionTop": ie ? 2 : 0,
"positionLeft": ie ? 2 : 0
"positionTop": 0,
"positionLeft": 0
},
{
"id": "#fixed-2",
"offsetTop": 1021,
"offsetLeft": 1021,
"positionTop": ie ? 22 : 20,
"positionLeft": ie ? 22 : 20
"positionTop": 20,
"positionLeft": 20
}
];
@ -415,7 +406,7 @@ testIframe("offset/scroll", "scroll", function( $, win ) {
expect(24);
// If we're going to bastardize the tests, let's just DO it
var ie = /msie [678]/i.test( navigator.userAgent );
var ie = /msie 8/i.test( navigator.userAgent );
if ( ie ) {
ok( true, "TestSwarm's iframe has hosed this test in oldIE, we surrender" );

View File

@ -272,7 +272,7 @@ test("disconnected nodes - jQuery only", function() {
});
testIframe("selector/html5_selector", "attributes - jQuery.attr", function( jQuery, window, document ) {
expect( 35 );
expect( 37 );
/**
* Returns an array of elements with the given IDs
@ -330,10 +330,10 @@ testIframe("selector/html5_selector", "attributes - jQuery.attr", function( jQue
t( "Attribute Exists", "[indeterminate]", []);
t( "Attribute Exists", "[ismap]", ["img1"]);
t( "Attribute Exists", "[itemscope]", ["div1"]);
// t( "Attribute Exists", "[loop]", ["video1"]); // IE 6/7 cannot differentiate here. loop is also used on img, input, and marquee tags as well as video/audio. getAttributeNode unfortunately also retrieves the property value.
t( "Attribute Exists", "[loop]", ["video1"]);
t( "Attribute Exists", "[multiple]", ["select1"]);
t( "Attribute Exists", "[muted]", ["audio1"]);
// t( "Attribute Exists", "[nohref]", ["area1"]); // IE 6/7 keep this set to false regardless of presence. The attribute node is not retrievable.
t( "Attribute Exists", "[nohref]", ["area1"]);
t( "Attribute Exists", "[noresize]", ["textarea1"]);
t( "Attribute Exists", "[noshade]", ["hr1"]);
t( "Attribute Exists", "[nowrap]", ["td1", "div1"]);

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

@ -20,11 +20,7 @@ var computedSupport = getComputedSupport( jQuery.support );
test( "zoom of doom (#13089)", function() {
expect( 1 );
if ( computedSupport.inlineBlockNeedsLayout ) {
ok( document.body.style.zoom, "Added a zoom to the body (#11048, #12869)" );
} else {
ok( !document.body.style.zoom, "No zoom added to the body" );
}
ok( !document.body.style.zoom, "No zoom added to the body" );
});
if ( jQuery.css ) {
@ -50,11 +46,6 @@ testIframeWithCallback( "A background on the testElement does not cause IE8 to c
ok( true, "IE8 does not crash" );
});
testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlocks", "support/shrinkWrapBlocks.html", function( shrinkWrapBlocks ) {
expect( 1 );
strictEqual( shrinkWrapBlocks, computedSupport.shrinkWrapBlocks, "jQuery.support.shrinkWrapBlocks properties are the same" );
});
// This test checkes CSP only for browsers with "Content-Security-Policy" header support
// i.e. no old WebKit or old Firefox
@ -78,10 +69,10 @@ 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,
"appendChecked": true,
"boxSizing": true,
"boxSizingReliable": true,
"changeBubbles": true,
"checkClone": true,
@ -90,13 +81,9 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"cors": true,
"cssFloat": true,
"deleteExpando": true,
"enctype": true,
"focusinBubbles": false,
"getSetAttribute": true,
"hrefNormalized": true,
"html5Clone": true,
"htmlSerialize": true,
"inlineBlockNeedsLayout": false,
"input": true,
"leadingWhitespace": true,
"noCloneChecked": true,
@ -109,53 +96,12 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"radioValue": true,
"reliableHiddenOffsets": true,
"reliableMarginRight": true,
"shrinkWrapBlocks": false,
"style": true,
"submitBubbles": true,
"tbody": true
};
} else if ( /opera.*version\/12\.1/i.test( userAgent ) ) {
expected = {
"ajax": true,
"appendChecked": true,
"boxSizing": true,
"boxSizingReliable": true,
"changeBubbles": true,
"checkClone": true,
"checkOn": true,
"clearCloneStyle": true,
"cors": true,
"cssFloat": true,
"deleteExpando": true,
"enctype": true,
"focusinBubbles": false,
"getSetAttribute": true,
"hrefNormalized": true,
"html5Clone": true,
"htmlSerialize": true,
"inlineBlockNeedsLayout": false,
"input": true,
"leadingWhitespace": true,
"noCloneChecked": true,
"noCloneEvent": true,
"opacity": true,
"optDisabled": true,
"optSelected": true,
"ownLast": false,
"pixelPosition": true,
"radioValue": false,
"reliableHiddenOffsets": true,
"reliableMarginRight": true,
"shrinkWrapBlocks": false,
"style": true,
"submitBubbles": true,
"tbody": true
"submitBubbles": true
};
} else if ( /trident\/7\.0/i.test( userAgent ) ) {
expected = {
"ajax": true,
"appendChecked": true,
"boxSizing": true,
"boxSizingReliable": false,
"changeBubbles": true,
"checkClone": true,
@ -164,13 +110,9 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"cors": true,
"cssFloat": true,
"deleteExpando": true,
"enctype": true,
"focusinBubbles": true,
"getSetAttribute": true,
"hrefNormalized": true,
"html5Clone": true,
"htmlSerialize": true,
"inlineBlockNeedsLayout": false,
"input": true,
"leadingWhitespace": true,
"noCloneChecked": false,
@ -183,16 +125,12 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"radioValue": false,
"reliableHiddenOffsets": true,
"reliableMarginRight": true,
"shrinkWrapBlocks": false,
"style": true,
"submitBubbles": true,
"tbody": true
"submitBubbles": true
};
} else if ( /msie 10\.0/i.test( userAgent ) ) {
expected = {
"ajax": true,
"appendChecked": true,
"boxSizing": true,
"boxSizingReliable": false,
"changeBubbles": true,
"checkClone": true,
@ -201,13 +139,9 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"cors": true,
"cssFloat": true,
"deleteExpando": true,
"enctype": true,
"focusinBubbles": true,
"getSetAttribute": true,
"hrefNormalized": true,
"html5Clone": true,
"htmlSerialize": true,
"inlineBlockNeedsLayout": false,
"input": true,
"leadingWhitespace": true,
"noCloneChecked": false,
@ -220,16 +154,12 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"radioValue": false,
"reliableHiddenOffsets": true,
"reliableMarginRight": true,
"shrinkWrapBlocks": false,
"style": true,
"submitBubbles": true,
"tbody": true
"submitBubbles": true
};
} else if ( /msie 9\.0/i.test( userAgent ) ) {
expected = {
"ajax": true,
"appendChecked": true,
"boxSizing": true,
"boxSizingReliable": false,
"changeBubbles": true,
"checkClone": true,
@ -238,13 +168,9 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"cors": false,
"cssFloat": true,
"deleteExpando": true,
"enctype": true,
"focusinBubbles": true,
"getSetAttribute": true,
"hrefNormalized": true,
"html5Clone": true,
"htmlSerialize": true,
"inlineBlockNeedsLayout": false,
"input": true,
"leadingWhitespace": true,
"noCloneChecked": false,
@ -257,16 +183,12 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"radioValue": false,
"reliableHiddenOffsets": true,
"reliableMarginRight": true,
"shrinkWrapBlocks": false,
"style": true,
"submitBubbles": true,
"tbody": true
"submitBubbles": true
};
} else if ( /msie 8\.0/i.test( userAgent ) ) {
expected = {
"ajax": true,
"appendChecked": true,
"boxSizing": true,
"boxSizingReliable": false,
"changeBubbles": false,
"checkClone": true,
@ -275,13 +197,9 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"cors": false,
"cssFloat": false,
"deleteExpando": false,
"enctype": true,
"focusinBubbles": true,
"getSetAttribute": true,
"hrefNormalized": true,
"html5Clone": false,
"htmlSerialize": false,
"inlineBlockNeedsLayout": false,
"input": false,
"leadingWhitespace": false,
"noCloneChecked": false,
@ -294,90 +212,12 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"radioValue": false,
"reliableHiddenOffsets": false,
"reliableMarginRight": true,
"shrinkWrapBlocks": false,
"style": false,
"submitBubbles": false,
"tbody": true
};
} else if ( /msie 7\.0/i.test( userAgent ) ) {
expected = {
"ajax": true,
"appendChecked": false,
"boxSizing": false,
"boxSizingReliable": false,
"changeBubbles": false,
"checkClone": true,
"checkOn": true,
"clearCloneStyle": true,
"cors": false,
"cssFloat": false,
"deleteExpando": false,
"enctype": true,
"focusinBubbles": true,
"getSetAttribute": false,
"hrefNormalized": false,
"html5Clone": false,
"htmlSerialize": false,
"inlineBlockNeedsLayout": true,
"input": true,
"leadingWhitespace": false,
"noCloneChecked": false,
"noCloneEvent": false,
"opacity": false,
"optDisabled": true,
"optSelected": false,
"ownLast": true,
"pixelPosition": false,
"radioValue": false,
"reliableHiddenOffsets": false,
"reliableMarginRight": true,
"shrinkWrapBlocks": false,
"style": false,
"submitBubbles": false,
"tbody": false
};
} else if ( /msie 6\.0/i.test( userAgent ) ) {
expected = {
"ajax": true,
"appendChecked": false,
"boxSizing": false,
"boxSizingReliable": false,
"changeBubbles": false,
"checkClone": true,
"checkOn": true,
"clearCloneStyle": true,
"cors": false,
"cssFloat": false,
"deleteExpando": false,
"enctype": true,
"focusinBubbles": true,
"getSetAttribute": false,
"hrefNormalized": false,
"html5Clone": false,
"htmlSerialize": false,
"inlineBlockNeedsLayout": true,
"input": true,
"leadingWhitespace": false,
"noCloneChecked": false,
"noCloneEvent": false,
"opacity": false,
"optDisabled": true,
"optSelected": false,
"ownLast": true,
"pixelPosition": false,
"radioValue": false,
"reliableHiddenOffsets": false,
"reliableMarginRight": true,
"shrinkWrapBlocks": true,
"style": false,
"submitBubbles": false,
"tbody": false
"submitBubbles": false
};
} else if ( /7\.0(\.\d+|) safari/i.test( userAgent ) ) {
expected = {
"ajax": true,
"appendChecked": true,
"boxSizing": true,
"boxSizingReliable": true,
"changeBubbles": true,
"checkClone": true,
@ -386,13 +226,9 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"cors": true,
"cssFloat": true,
"deleteExpando": true,
"enctype": true,
"focusinBubbles": false,
"getSetAttribute": true,
"hrefNormalized": true,
"html5Clone": true,
"htmlSerialize": true,
"inlineBlockNeedsLayout": false,
"input": true,
"leadingWhitespace": true,
"noCloneChecked": true,
@ -405,16 +241,12 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"radioValue": true,
"reliableHiddenOffsets": true,
"reliableMarginRight": true,
"shrinkWrapBlocks": false,
"style": true,
"submitBubbles": true,
"tbody": true
"submitBubbles": true
};
} else if ( /6\.0(\.\d+|) safari/i.test( userAgent ) ) {
expected = {
"ajax": true,
"appendChecked": true,
"boxSizing": true,
"boxSizingReliable": true,
"changeBubbles": true,
"checkClone": true,
@ -423,13 +255,9 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"cors": true,
"cssFloat": true,
"deleteExpando": true,
"enctype": true,
"focusinBubbles": false,
"getSetAttribute": true,
"hrefNormalized": true,
"html5Clone": true,
"htmlSerialize": true,
"inlineBlockNeedsLayout": false,
"input": true,
"leadingWhitespace": true,
"noCloneChecked": true,
@ -442,53 +270,12 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"radioValue": true,
"reliableHiddenOffsets": true,
"reliableMarginRight": true,
"shrinkWrapBlocks": false,
"style": true,
"submitBubbles": true,
"tbody": true
};
} else if ( /5\.1(\.\d+|) safari/i.test( userAgent ) ) {
expected = {
"ajax": true,
"appendChecked": true,
"boxSizing": true,
"boxSizingReliable": true,
"changeBubbles": true,
"checkClone": false,
"checkOn": false,
"clearCloneStyle": true,
"cors": true,
"cssFloat": true,
"deleteExpando": true,
"enctype": true,
"focusinBubbles": false,
"getSetAttribute": true,
"hrefNormalized": true,
"html5Clone": true,
"htmlSerialize": true,
"inlineBlockNeedsLayout": false,
"input": true,
"leadingWhitespace": true,
"noCloneChecked": true,
"noCloneEvent": true,
"opacity": true,
"optDisabled": true,
"optSelected": true,
"ownLast": false,
"pixelPosition": false,
"radioValue": true,
"reliableHiddenOffsets": true,
"reliableMarginRight": true,
"shrinkWrapBlocks": false,
"style": true,
"submitBubbles": true,
"tbody": true
"submitBubbles": true
};
} else if ( /firefox/i.test( userAgent ) ) {
expected = {
"ajax": true,
"appendChecked": true,
"boxSizing": true,
"boxSizingReliable": true,
"changeBubbles": true,
"checkClone": true,
@ -497,13 +284,9 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"cors": true,
"cssFloat": true,
"deleteExpando": true,
"enctype": true,
"focusinBubbles": false,
"getSetAttribute": true,
"hrefNormalized": true,
"html5Clone": true,
"htmlSerialize": true,
"inlineBlockNeedsLayout": false,
"input": true,
"leadingWhitespace": true,
"noCloneChecked": true,
@ -516,16 +299,12 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"radioValue": true,
"reliableHiddenOffsets": true,
"reliableMarginRight": true,
"shrinkWrapBlocks": false,
"style": true,
"submitBubbles": true,
"tbody": true
"submitBubbles": true
};
} else if ( /iphone os (?:6|7)_/i.test( userAgent ) ) {
} else if ( /iphone os/i.test( userAgent ) ) {
expected = {
"ajax": true,
"appendChecked": true,
"boxSizing": true,
"boxSizingReliable": true,
"changeBubbles": true,
"checkClone": true,
@ -534,13 +313,9 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"cors": true,
"cssFloat": true,
"deleteExpando": true,
"enctype": true,
"focusinBubbles": false,
"getSetAttribute": true,
"hrefNormalized": true,
"html5Clone": true,
"htmlSerialize": true,
"inlineBlockNeedsLayout": false,
"input": true,
"leadingWhitespace": true,
"noCloneChecked": true,
@ -553,16 +328,12 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"radioValue": true,
"reliableHiddenOffsets": true,
"reliableMarginRight": true,
"shrinkWrapBlocks": false,
"style": true,
"submitBubbles": true,
"tbody": true
"submitBubbles": true
};
} else if ( /android 2\.3/i.test( userAgent ) ) {
expected = {
"ajax": true,
"appendChecked": true,
"boxSizing": true,
"boxSizingReliable": true,
"changeBubbles": true,
"checkClone": true,
@ -571,13 +342,9 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"cors": true,
"cssFloat": true,
"deleteExpando": true,
"enctype": true,
"focusinBubbles": false,
"getSetAttribute": true,
"hrefNormalized": true,
"html5Clone": true,
"htmlSerialize": true,
"inlineBlockNeedsLayout": false,
"input": true,
"leadingWhitespace": true,
"noCloneChecked": true,
@ -590,16 +357,12 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"radioValue": true,
"reliableHiddenOffsets": true,
"reliableMarginRight": false,
"shrinkWrapBlocks": false,
"style": true,
"submitBubbles": true,
"tbody": true
"submitBubbles": true
};
} else if ( /android 4\.[0-3]/i.test( userAgent ) ) {
expected = {
"ajax": true,
"appendChecked": true,
"boxSizing": true,
"boxSizingReliable": true,
"changeBubbles": true,
"checkClone": false,
@ -608,13 +371,9 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"cors": true,
"cssFloat": true,
"deleteExpando": true,
"enctype": true,
"focusinBubbles": false,
"getSetAttribute": true,
"hrefNormalized": true,
"html5Clone": true,
"htmlSerialize": true,
"inlineBlockNeedsLayout": false,
"input": true,
"leadingWhitespace": true,
"noCloneChecked": true,
@ -627,10 +386,8 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"radioValue": true,
"reliableHiddenOffsets": true,
"reliableMarginRight": true,
"shrinkWrapBlocks": false,
"style": true,
"submitBubbles": true,
"tbody": true
"submitBubbles": true
};
}

View File

@ -47,8 +47,7 @@ function testWrap( val ) {
j = jQuery("#nonnodes").contents();
j.wrap( val("<i></i>") );
// Blackberry 4.6 doesn't maintain comments in the DOM
equal( jQuery("#nonnodes > i").length, jQuery("#nonnodes")[ 0 ].childNodes.length, "Check node,textnode,comment wraps ok" );
equal( jQuery("#nonnodes > i").length, 3, "Check node,textnode,comment wraps ok" );
equal( jQuery("#nonnodes > i").text(), j.text(), "Check node,textnode,comment wraps doesn't hurt text" );
// Try wrapping a disconnected node