Merge branch 'master' of github.com:jquery/jquery into 1.7/callbacks
Conflicts: test/index.html
This commit is contained in:
commit
1ed70e056d
25 changed files with 529 additions and 143 deletions
|
@ -9,9 +9,9 @@ var fs = require("fs"),
|
|||
extract = /<a href="\/ticket\/(\d+)" title="View ticket">(.*?)<[^"]+"component">\s*(\S+)/g;
|
||||
|
||||
var opts = {
|
||||
version: "1.6",
|
||||
short_version: "1.6",
|
||||
final_version: "1.6",
|
||||
version: "1.6.1 RC 1",
|
||||
short_version: "1.6rc1",
|
||||
final_version: "1.6.1",
|
||||
categories: []
|
||||
};
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ var rclass = /[\n\t\r]/g,
|
|||
rfocusable = /^(?:button|input|object|select|textarea)$/i,
|
||||
rclickable = /^a(?:rea)?$/i,
|
||||
rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
|
||||
rinvalidChar = /\:/,
|
||||
rinvalidChar = /\:|^on/,
|
||||
formHook, boolHook;
|
||||
|
||||
jQuery.fn.extend({
|
||||
|
@ -20,11 +20,11 @@ jQuery.fn.extend({
|
|||
jQuery.removeAttr( this, name );
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
prop: function( name, value ) {
|
||||
return jQuery.access( this, name, value, true, jQuery.prop );
|
||||
},
|
||||
|
||||
|
||||
removeProp: function( name ) {
|
||||
name = jQuery.propFix[ name ] || name;
|
||||
return this.each(function() {
|
||||
|
@ -156,7 +156,7 @@ jQuery.fn.extend({
|
|||
val: function( value ) {
|
||||
var hooks, ret,
|
||||
elem = this[0];
|
||||
|
||||
|
||||
if ( !arguments.length ) {
|
||||
if ( elem ) {
|
||||
hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ];
|
||||
|
@ -165,7 +165,13 @@ jQuery.fn.extend({
|
|||
return ret;
|
||||
}
|
||||
|
||||
return (elem.value || "").replace(rreturn, "");
|
||||
ret = elem.value;
|
||||
|
||||
return typeof ret === "string" ?
|
||||
// handle most common string cases
|
||||
ret.replace(rreturn, "") :
|
||||
// handle cases where value is null/undef or number
|
||||
ret == null ? "" : ret;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
|
@ -284,15 +290,15 @@ jQuery.extend({
|
|||
height: true,
|
||||
offset: true
|
||||
},
|
||||
|
||||
|
||||
attrFix: {
|
||||
// Always normalize to ensure hook usage
|
||||
tabindex: "tabIndex"
|
||||
},
|
||||
|
||||
|
||||
attr: function( elem, name, value, pass ) {
|
||||
var nType = elem.nodeType;
|
||||
|
||||
|
||||
// don't get/set attributes on text, comment and attribute nodes
|
||||
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
|
||||
return undefined;
|
||||
|
@ -301,10 +307,15 @@ jQuery.extend({
|
|||
if ( pass && name in jQuery.attrFn ) {
|
||||
return jQuery( elem )[ name ]( value );
|
||||
}
|
||||
|
||||
|
||||
// Fallback to prop when attributes are not supported
|
||||
if ( !("getAttribute" in elem) ) {
|
||||
return jQuery.prop( elem, name, value );
|
||||
}
|
||||
|
||||
var ret, hooks,
|
||||
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
|
||||
|
||||
|
||||
// Normalize the name if needed
|
||||
name = notxml && jQuery.attrFix[ name ] || name;
|
||||
|
||||
|
@ -312,13 +323,14 @@ jQuery.extend({
|
|||
|
||||
if ( !hooks ) {
|
||||
// Use boolHook for boolean attributes
|
||||
if ( rboolean.test( name ) &&
|
||||
(typeof value === "boolean" || value === undefined || value.toLowerCase() === name.toLowerCase()) ) {
|
||||
if ( rboolean.test( name ) ) {
|
||||
|
||||
hooks = boolHook;
|
||||
|
||||
// Use formHook for forms and if the name contains certain characters
|
||||
} else if ( formHook && (jQuery.nodeName( elem, "form" ) || rinvalidChar.test( name )) ) {
|
||||
} else if ( formHook && name !== "className" &&
|
||||
(jQuery.nodeName( elem, "form" ) || rinvalidChar.test( name )) ) {
|
||||
|
||||
hooks = formHook;
|
||||
}
|
||||
}
|
||||
|
@ -337,8 +349,8 @@ jQuery.extend({
|
|||
return value;
|
||||
}
|
||||
|
||||
} else if ( hooks && "get" in hooks && notxml ) {
|
||||
return hooks.get( elem, name );
|
||||
} else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {
|
||||
return ret;
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -355,7 +367,7 @@ jQuery.extend({
|
|||
var propName;
|
||||
if ( elem.nodeType === 1 ) {
|
||||
name = jQuery.attrFix[ name ] || name;
|
||||
|
||||
|
||||
if ( jQuery.support.getSetAttribute ) {
|
||||
// Use removeAttribute in browsers that support it
|
||||
elem.removeAttribute( name );
|
||||
|
@ -381,7 +393,7 @@ jQuery.extend({
|
|||
// Setting the type on a radio button after the value resets the value in IE6-9
|
||||
// Reset value to it's default in case type is set after value
|
||||
// This is for element creation
|
||||
var val = elem.getAttribute("value");
|
||||
var val = elem.value;
|
||||
elem.setAttribute( "type", value );
|
||||
if ( val ) {
|
||||
elem.value = val;
|
||||
|
@ -404,7 +416,7 @@ jQuery.extend({
|
|||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
propFix: {
|
||||
tabindex: "tabIndex",
|
||||
readonly: "readOnly",
|
||||
|
@ -419,41 +431,41 @@ jQuery.extend({
|
|||
frameborder: "frameBorder",
|
||||
contenteditable: "contentEditable"
|
||||
},
|
||||
|
||||
|
||||
prop: function( elem, name, value ) {
|
||||
var nType = elem.nodeType;
|
||||
|
||||
|
||||
// don't get/set properties on text, comment and attribute nodes
|
||||
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
var ret, hooks,
|
||||
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
|
||||
|
||||
|
||||
// Try to normalize/fix the name
|
||||
name = notxml && jQuery.propFix[ name ] || name;
|
||||
|
||||
|
||||
hooks = jQuery.propHooks[ name ];
|
||||
|
||||
|
||||
if ( value !== undefined ) {
|
||||
if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
|
||||
return ret;
|
||||
|
||||
|
||||
} else {
|
||||
return (elem[ name ] = value);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== undefined ) {
|
||||
return ret;
|
||||
|
||||
|
||||
} else {
|
||||
return elem[ name ];
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
propHooks: {}
|
||||
});
|
||||
|
||||
|
@ -461,7 +473,7 @@ jQuery.extend({
|
|||
boolHook = {
|
||||
get: function( elem, name ) {
|
||||
// Align boolean attributes with corresponding properties
|
||||
return elem[ jQuery.propFix[ name ] || name ] ?
|
||||
return jQuery.prop( elem, name ) ?
|
||||
name.toLowerCase() :
|
||||
undefined;
|
||||
},
|
||||
|
@ -476,7 +488,7 @@ boolHook = {
|
|||
propName = jQuery.propFix[ name ] || name;
|
||||
if ( propName in elem ) {
|
||||
// Only set the IDL specifically if it already exists on the element
|
||||
elem[ propName ] = value;
|
||||
elem[ propName ] = true;
|
||||
}
|
||||
|
||||
elem.setAttribute( name, name.toLowerCase() );
|
||||
|
@ -485,14 +497,34 @@ boolHook = {
|
|||
}
|
||||
};
|
||||
|
||||
// Use the value property for back compat
|
||||
// Use the formHook for button elements in IE6/7 (#1954)
|
||||
jQuery.attrHooks.value = {
|
||||
get: function( elem, name ) {
|
||||
if ( formHook && jQuery.nodeName( elem, "button" ) ) {
|
||||
return formHook.get( elem, name );
|
||||
}
|
||||
return name in elem ?
|
||||
elem.value :
|
||||
null;
|
||||
},
|
||||
set: function( elem, value, name ) {
|
||||
if ( formHook && jQuery.nodeName( elem, "button" ) ) {
|
||||
return formHook.set( elem, value, name );
|
||||
}
|
||||
// Does not return so that setAttribute is also used
|
||||
elem.value = value;
|
||||
}
|
||||
};
|
||||
|
||||
// IE6/7 do not support getting/setting some attributes with get/setAttribute
|
||||
if ( !jQuery.support.getSetAttribute ) {
|
||||
|
||||
// propFix is more comprehensive and contains all fixes
|
||||
jQuery.attrFix = jQuery.propFix;
|
||||
|
||||
|
||||
// Use this for any attribute on a form in IE6/7
|
||||
formHook = jQuery.attrHooks.name = jQuery.attrHooks.value = jQuery.valHooks.button = {
|
||||
formHook = jQuery.attrHooks.name = jQuery.attrHooks.title = jQuery.valHooks.button = {
|
||||
get: function( elem, name ) {
|
||||
var ret;
|
||||
ret = elem.getAttributeNode( name );
|
||||
|
|
|
@ -96,6 +96,8 @@ jQuery.extend({
|
|||
// convert relative number strings (+= or -=) to relative numbers. #7345
|
||||
if ( type === "string" && rrelNum.test( value ) ) {
|
||||
value = +value.replace( rrelNumFilter, "" ) + parseFloat( jQuery.css( elem, name ) );
|
||||
// Fixes bug #9237
|
||||
type = "number";
|
||||
}
|
||||
|
||||
// If a number was passed in, add 'px' to the (except for certain CSS properties)
|
||||
|
|
|
@ -98,7 +98,7 @@ jQuery.extend({
|
|||
}
|
||||
|
||||
if ( data !== undefined ) {
|
||||
thisCache[ name ] = data;
|
||||
thisCache[ jQuery.camelCase( name ) ] = data;
|
||||
}
|
||||
|
||||
// TODO: This is a hack for 1.5 ONLY. It will be removed in 1.6. Users should
|
||||
|
@ -108,7 +108,7 @@ jQuery.extend({
|
|||
return thisCache[ internalKey ] && thisCache[ internalKey ].events;
|
||||
}
|
||||
|
||||
return getByName ? thisCache[ name ] : thisCache;
|
||||
return getByName ? thisCache[ jQuery.camelCase( name ) ] : thisCache;
|
||||
},
|
||||
|
||||
removeData: function( elem, name, pvt /* Internal Use Only */ ) {
|
||||
|
|
29
src/effects.js
vendored
29
src/effects.js
vendored
|
@ -258,7 +258,6 @@ jQuery.fn.extend({
|
|||
if ( !gotoEnd ) {
|
||||
jQuery._unmark( true, this );
|
||||
}
|
||||
// go in reverse order so anything added to the queue during the loop is ignored
|
||||
while ( i-- ) {
|
||||
if ( timers[i].elem === this ) {
|
||||
if (gotoEnd) {
|
||||
|
@ -331,15 +330,15 @@ jQuery.extend({
|
|||
// Queueing
|
||||
opt.old = opt.complete;
|
||||
opt.complete = function( noUnmark ) {
|
||||
if ( jQuery.isFunction( opt.old ) ) {
|
||||
opt.old.call( this );
|
||||
}
|
||||
|
||||
if ( opt.queue !== false ) {
|
||||
jQuery.dequeue( this );
|
||||
} else if ( noUnmark !== false ) {
|
||||
jQuery._unmark( this );
|
||||
}
|
||||
|
||||
if ( jQuery.isFunction( opt.old ) ) {
|
||||
opt.old.call( this );
|
||||
}
|
||||
};
|
||||
|
||||
return opt;
|
||||
|
@ -522,11 +521,9 @@ jQuery.fx.prototype = {
|
|||
|
||||
jQuery.extend( jQuery.fx, {
|
||||
tick: function() {
|
||||
var timers = jQuery.timers,
|
||||
i = timers.length;
|
||||
while ( i-- ) {
|
||||
for ( var timers = jQuery.timers, i = 0 ; i < timers.length ; ++i ) {
|
||||
if ( !timers[i]() ) {
|
||||
timers.splice(i, 1);
|
||||
timers.splice(i--, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -577,7 +574,8 @@ function defaultDisplay( nodeName ) {
|
|||
|
||||
if ( !elemdisplay[ nodeName ] ) {
|
||||
|
||||
var elem = jQuery( "<" + nodeName + ">" ).appendTo( "body" ),
|
||||
var body = document.body,
|
||||
elem = jQuery( "<" + nodeName + ">" ).appendTo( body ),
|
||||
display = elem.css( "display" );
|
||||
|
||||
elem.remove();
|
||||
|
@ -591,14 +589,15 @@ function defaultDisplay( nodeName ) {
|
|||
iframe.frameBorder = iframe.width = iframe.height = 0;
|
||||
}
|
||||
|
||||
document.body.appendChild( iframe );
|
||||
body.appendChild( iframe );
|
||||
|
||||
// Create a cacheable copy of the iframe document on first call.
|
||||
// IE and Opera will allow us to reuse the iframeDoc without re-writing the fake html
|
||||
// document to it, Webkit & Firefox won't allow reusing the iframe document
|
||||
// IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML
|
||||
// document to it; WebKit & Firefox won't allow reusing the iframe document.
|
||||
if ( !iframeDoc || !iframe.createElement ) {
|
||||
iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
|
||||
iframeDoc.write( "<!doctype><html><body></body></html>" );
|
||||
iframeDoc.write( ( document.compatMode === "CSS1Compat" ? "<!doctype html>" : "" ) + "<html><body>" );
|
||||
iframeDoc.close();
|
||||
}
|
||||
|
||||
elem = iframeDoc.createElement( nodeName );
|
||||
|
@ -607,7 +606,7 @@ function defaultDisplay( nodeName ) {
|
|||
|
||||
display = jQuery.css( elem, "display" );
|
||||
|
||||
document.body.removeChild( iframe );
|
||||
body.removeChild( iframe );
|
||||
}
|
||||
|
||||
// Store the correct default display
|
||||
|
|
|
@ -345,7 +345,7 @@ jQuery.event = {
|
|||
event.target = elem;
|
||||
|
||||
// Clone any incoming data and prepend the event, creating the handler arg list
|
||||
data = data ? jQuery.makeArray( data ) : [];
|
||||
data = data != null ? jQuery.makeArray( data ) : [];
|
||||
data.unshift( event );
|
||||
|
||||
var cur = elem,
|
||||
|
@ -654,6 +654,9 @@ var withinElement = function( event ) {
|
|||
// Check if mouse(over|out) are still within the same parent element
|
||||
var parent = event.relatedTarget;
|
||||
|
||||
// set the correct event type
|
||||
event.type = event.data;
|
||||
|
||||
// Firefox sometimes assigns relatedTarget a XUL element
|
||||
// which we cannot access the parentNode property of
|
||||
try {
|
||||
|
@ -663,15 +666,13 @@ var withinElement = function( event ) {
|
|||
if ( parent && parent !== document && !parent.parentNode ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Traverse up the tree
|
||||
while ( parent && parent !== this ) {
|
||||
parent = parent.parentNode;
|
||||
}
|
||||
|
||||
if ( parent !== this ) {
|
||||
// set the correct event type
|
||||
event.type = event.data;
|
||||
|
||||
// handle event if we actually just moused on to a non sub-element
|
||||
jQuery.event.handle.apply( this, arguments );
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
|
|||
// checked="checked" or checked
|
||||
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
|
||||
rscriptType = /\/(java|ecma)script/i,
|
||||
rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)/,
|
||||
wrapMap = {
|
||||
option: [ 1, "<select multiple='multiple'>", "</select>" ],
|
||||
legend: [ 1, "<fieldset>", "</fieldset>" ],
|
||||
|
@ -437,8 +438,21 @@ function cloneFixAttributes( src, dest ) {
|
|||
}
|
||||
|
||||
jQuery.buildFragment = function( args, nodes, scripts ) {
|
||||
var fragment, cacheable, cacheresults,
|
||||
doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document);
|
||||
var fragment, cacheable, cacheresults, doc;
|
||||
|
||||
// nodes may contain either an explicit document object,
|
||||
// a jQuery collection or context object.
|
||||
// If nodes[0] contains a valid object to assign to doc
|
||||
if ( nodes && nodes[0] ) {
|
||||
doc = nodes[0].ownerDocument || nodes[0];
|
||||
}
|
||||
|
||||
// Ensure that an attr object doesn't incorrectly stand in as a document object
|
||||
// Chrome and Firefox seem to allow this to occur and will throw exception
|
||||
// Fixes #8950
|
||||
if ( !doc.createDocumentFragment ) {
|
||||
doc = document;
|
||||
}
|
||||
|
||||
// Only cache "small" (1/2 KB) HTML strings that are associated with the main document
|
||||
// Cloning options loses the selected state, so don't cache them
|
||||
|
@ -500,7 +514,7 @@ jQuery.each({
|
|||
function getAll( elem ) {
|
||||
if ( "getElementsByTagName" in elem ) {
|
||||
return elem.getElementsByTagName( "*" );
|
||||
|
||||
|
||||
} else if ( "querySelectorAll" in elem ) {
|
||||
return elem.querySelectorAll( "*" );
|
||||
|
||||
|
@ -738,7 +752,7 @@ function evalScript( i, elem ) {
|
|||
dataType: "script"
|
||||
});
|
||||
} else {
|
||||
jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
|
||||
jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "/*$0*/" ) );
|
||||
}
|
||||
|
||||
if ( elem.parentNode ) {
|
||||
|
@ -746,4 +760,4 @@ function evalScript( i, elem ) {
|
|||
}
|
||||
}
|
||||
|
||||
})( jQuery );
|
||||
})( jQuery );
|
|
@ -1 +1 @@
|
|||
Subproject commit 4bcc09702d6dadfd0b90c7de3c8b206e97ff97f4
|
||||
Subproject commit 3ba396e439a07c2a2facafbe07cdaa1b80a24c00
|
|
@ -13,7 +13,9 @@ jQuery.support = (function() {
|
|||
support,
|
||||
fragment,
|
||||
body,
|
||||
bodyStyle,
|
||||
testElementParent,
|
||||
testElement,
|
||||
testElementStyle,
|
||||
tds,
|
||||
events,
|
||||
eventName,
|
||||
|
@ -136,9 +138,11 @@ jQuery.support = (function() {
|
|||
// Figure out if the W3C box model works as expected
|
||||
div.style.width = div.style.paddingLeft = "1px";
|
||||
|
||||
// We use our own, invisible, body
|
||||
body = document.createElement( "body" );
|
||||
bodyStyle = {
|
||||
body = document.getElementsByTagName( "body" )[ 0 ];
|
||||
// We use our own, invisible, body unless the body is already present
|
||||
// in which case we use a div (#9239)
|
||||
testElement = document.createElement( body ? "div" : "body" );
|
||||
testElementStyle = {
|
||||
visibility: "hidden",
|
||||
width: 0,
|
||||
height: 0,
|
||||
|
@ -147,11 +151,19 @@ jQuery.support = (function() {
|
|||
// Set background to avoid IE crashes when removing (#9028)
|
||||
background: "none"
|
||||
};
|
||||
for ( i in bodyStyle ) {
|
||||
body.style[ i ] = bodyStyle[ i ];
|
||||
if ( body ) {
|
||||
jQuery.extend( testElementStyle, {
|
||||
position: "absolute",
|
||||
left: -1000,
|
||||
top: -1000
|
||||
});
|
||||
}
|
||||
body.appendChild( div );
|
||||
documentElement.insertBefore( body, documentElement.firstChild );
|
||||
for ( i in testElementStyle ) {
|
||||
testElement.style[ i ] = testElementStyle[ i ];
|
||||
}
|
||||
testElement.appendChild( div );
|
||||
testElementParent = body || documentElement;
|
||||
testElementParent.insertBefore( testElement, testElementParent.firstChild );
|
||||
|
||||
// Check if a disconnected checkbox will retain its checked
|
||||
// value of true after appended to the DOM (IE6/7)
|
||||
|
@ -206,12 +218,12 @@ jQuery.support = (function() {
|
|||
marginDiv.style.marginRight = "0";
|
||||
div.appendChild( marginDiv );
|
||||
support.reliableMarginRight =
|
||||
( parseInt( document.defaultView.getComputedStyle( marginDiv, null ).marginRight, 10 ) || 0 ) === 0;
|
||||
( parseInt( ( document.defaultView.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
|
||||
}
|
||||
|
||||
// Remove the body element we added
|
||||
body.innerHTML = "";
|
||||
documentElement.removeChild( body );
|
||||
testElement.innerHTML = "";
|
||||
testElementParent.removeChild( testElement );
|
||||
|
||||
// Technique from Juriy Zaytsev
|
||||
// http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<body>
|
||||
<h3>jQuery Test boxModel detection in IE 6 & 7 compatMode="CSS1Compat"</h3>
|
||||
<div>document.compatMode = <span id="compat-mode">?</span></div>
|
||||
<div>jQuery.support.boxModel = <span id="box-model">?</span></div>
|
||||
<script src="../src/core.js"></script>
|
||||
<script src="../src/deferred.js"></script>
|
||||
<script src="../src/support.js"></script>
|
||||
<script src="../src/data.js"></script>
|
||||
<script src="../src/queue.js"></script>
|
||||
<script src="../src/attributes.js"></script>
|
||||
<script src="../src/event.js"></script>
|
||||
<script src="../src/sizzle/sizzle.js"></script>
|
||||
<script src="../src/sizzle-jquery.js"></script>
|
||||
<script src="../src/traversing.js"></script>
|
||||
<script src="../src/manipulation.js"></script>
|
||||
<script src="../src/css.js"></script>
|
||||
<script src="../src/ajax.js"></script>
|
||||
<script src="../src/ajax/jsonp.js"></script>
|
||||
<script src="../src/ajax/script.js"></script>
|
||||
<script src="../src/ajax/xhr.js"></script>
|
||||
<script src="../src/effects.js"></script>
|
||||
<script src="../src/offset.js"></script>
|
||||
<script src="../src/dimensions.js"></script>
|
||||
<script>
|
||||
jQuery(function() {
|
||||
jQuery( "#compat-mode" ).text( document.compatMode );
|
||||
jQuery( "#box-model" ).text( jQuery.support.boxModel );
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
37
test/data/support/bodyBackground.html
Normal file
37
test/data/support/bodyBackground.html
Normal file
|
@ -0,0 +1,37 @@
|
|||
<!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>
|
||||
body {
|
||||
background: #000000;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<script src="../../../src/core.js"></script>
|
||||
<script src="../../../src/deferred.js"></script>
|
||||
<script src="../../../src/support.js"></script>
|
||||
<script src="../../../src/data.js"></script>
|
||||
<script src="../../../src/queue.js"></script>
|
||||
<script src="../../../src/attributes.js"></script>
|
||||
<script src="../../../src/event.js"></script>
|
||||
<script src="../../../src/sizzle/sizzle.js"></script>
|
||||
<script src="../../../src/sizzle-jquery.js"></script>
|
||||
<script src="../../../src/traversing.js"></script>
|
||||
<script src="../../../src/manipulation.js"></script>
|
||||
<script src="../../../src/css.js"></script>
|
||||
<script src="../../../src/ajax.js"></script>
|
||||
<script src="../../../src/ajax/jsonp.js"></script>
|
||||
<script src="../../../src/ajax/script.js"></script>
|
||||
<script src="../../../src/ajax/xhr.js"></script>
|
||||
<script src="../../../src/effects.js"></script>
|
||||
<script src="../../../src/offset.js"></script>
|
||||
<script src="../../../src/dimensions.js"></script>
|
||||
</div>
|
||||
<script>
|
||||
window.top.supportCallback( jQuery( "body" ).css( "backgroundColor" ), jQuery.support );
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
27
test/data/support/boxModelIE.html
Normal file
27
test/data/support/boxModelIE.html
Normal file
|
@ -0,0 +1,27 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<body>
|
||||
<script src="../../../src/core.js"></script>
|
||||
<script src="../../../src/deferred.js"></script>
|
||||
<script src="../../../src/support.js"></script>
|
||||
<script src="../../../src/data.js"></script>
|
||||
<script src="../../../src/queue.js"></script>
|
||||
<script src="../../../src/attributes.js"></script>
|
||||
<script src="../../../src/event.js"></script>
|
||||
<script src="../../../src/sizzle/sizzle.js"></script>
|
||||
<script src="../../../src/sizzle-jquery.js"></script>
|
||||
<script src="../../../src/traversing.js"></script>
|
||||
<script src="../../../src/manipulation.js"></script>
|
||||
<script src="../../../src/css.js"></script>
|
||||
<script src="../../../src/ajax.js"></script>
|
||||
<script src="../../../src/ajax/jsonp.js"></script>
|
||||
<script src="../../../src/ajax/script.js"></script>
|
||||
<script src="../../../src/ajax/xhr.js"></script>
|
||||
<script src="../../../src/effects.js"></script>
|
||||
<script src="../../../src/offset.js"></script>
|
||||
<script src="../../../src/dimensions.js"></script>
|
||||
<script>
|
||||
window.top.supportCallback( document.compatMode, jQuery.support.boxModel );
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
25
test/data/support/hiddenIFrameFF.html
Normal file
25
test/data/support/hiddenIFrameFF.html
Normal file
|
@ -0,0 +1,25 @@
|
|||
<html>
|
||||
<head>
|
||||
<script src="../../../src/core.js"></script>
|
||||
<script src="../../../src/deferred.js"></script>
|
||||
<script src="../../../src/support.js"></script>
|
||||
<script src="../../../src/data.js"></script>
|
||||
<script src="../../../src/queue.js"></script>
|
||||
<script src="../../../src/attributes.js"></script>
|
||||
<script src="../../../src/event.js"></script>
|
||||
<script src="../../../src/sizzle/sizzle.js"></script>
|
||||
<script src="../../../src/sizzle-jquery.js"></script>
|
||||
<script src="../../../src/traversing.js"></script>
|
||||
<script src="../../../src/manipulation.js"></script>
|
||||
<script src="../../../src/css.js"></script>
|
||||
<script src="../../../src/ajax.js"></script>
|
||||
<script src="../../../src/ajax/jsonp.js"></script>
|
||||
<script src="../../../src/ajax/script.js"></script>
|
||||
<script src="../../../src/ajax/xhr.js"></script>
|
||||
<script src="../../../src/effects.js"></script>
|
||||
<script src="../../../src/offset.js"></script>
|
||||
<script src="../../../src/dimensions.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
|
@ -182,11 +182,21 @@
|
|||
<td id='submitSubmit' class="red">BUTTON</td>
|
||||
<td id='boundSubmit' class="red">DOCUMENT</td>
|
||||
</tr>
|
||||
</table>
|
||||
</table>
|
||||
|
||||
<h1>Mouseleave Tests</h1>
|
||||
|
||||
<div class="out" style="margin:20px; border:1px solid #000; background: red;">
|
||||
<p>Count mouse leave event</p>
|
||||
<div class="in" style="background: green; margin: 10px auto; width: 50%;">
|
||||
<p>mouse over here should not trigger the counter.</p>
|
||||
</div>
|
||||
<p>0</p>
|
||||
</div>
|
||||
|
||||
<ul id="log"></ul>
|
||||
|
||||
<script type='text/javascript'>
|
||||
<script type='text/javascript'>
|
||||
jQuery.fn.addChangeClickTest = function( id, prevent ) {
|
||||
this.bind("focusin", function(){
|
||||
jQuery(id + "focus").blink();
|
||||
|
@ -270,6 +280,10 @@
|
|||
jQuery("#boundSubmit").blink();
|
||||
});
|
||||
|
||||
</script>
|
||||
var n = 0;
|
||||
$("div.out").live("mouseleave", function() {
|
||||
$("p:last", this).text(++n);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
<script src="data/testrunner.js"></script>
|
||||
|
||||
<script src="unit/core.js"></script>
|
||||
<script src="unit/support.js"></script>
|
||||
<script src="unit/callbacks.js"></script>
|
||||
<script src="unit/deferred.js"></script>
|
||||
<script src="unit/data.js"></script>
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 9887663380693009874e8c76f0bf77a921931766
|
||||
Subproject commit d97b37ec322136406790e75d03333559f38bbecb
|
|
@ -6,7 +6,7 @@ var functionReturningObj = function(value) { return (function() { return value;
|
|||
|
||||
test("jQuery.attrFix/jQuery.propFix integrity test", function() {
|
||||
expect(2);
|
||||
|
||||
|
||||
// This must be maintained and equal jQuery.attrFix when appropriate
|
||||
// Ensure that accidental or erroneous property
|
||||
// overwrites don't occur
|
||||
|
@ -40,7 +40,7 @@ test("jQuery.attrFix/jQuery.propFix integrity test", function() {
|
|||
});
|
||||
|
||||
test("attr(String)", function() {
|
||||
expect(37);
|
||||
expect(45);
|
||||
|
||||
equals( jQuery("#text1").attr("type"), "text", "Check for type attribute" );
|
||||
equals( jQuery("#radio1").attr("type"), "radio", "Check for type attribute" );
|
||||
|
@ -54,9 +54,10 @@ test("attr(String)", function() {
|
|||
equals( jQuery("#text1").attr("name"), "action", "Check for name attribute" );
|
||||
ok( jQuery("#form").attr("action").indexOf("formaction") >= 0, "Check for action attribute" );
|
||||
equals( jQuery("#text1").attr("value", "t").attr("value"), "t", "Check setting the value attribute" );
|
||||
equals( jQuery("<div value='t'></div>").attr("value"), "t", "Check setting custom attr named 'value' on a div" );
|
||||
equals( jQuery("#form").attr("blah", "blah").attr("blah"), "blah", "Set non-existant attribute on a form" );
|
||||
equals( jQuery("#foo").attr("height"), undefined, "Non existent height attribute should return undefined" );
|
||||
|
||||
|
||||
// [7472] & [3113] (form contains an input with name="action" or name="id")
|
||||
var extras = jQuery("<input name='id' name='name' /><input id='target' name='target' />").appendTo("#testForm");
|
||||
equals( jQuery("#form").attr("action","newformaction").attr("action"), "newformaction", "Check that action attribute was changed" );
|
||||
|
@ -66,7 +67,7 @@ test("attr(String)", function() {
|
|||
// Bug #3685 (form contains input with name="name")
|
||||
equals( jQuery("#testForm").attr("name"), undefined, "Retrieving name does not retrieve input with name=name" );
|
||||
extras.remove();
|
||||
|
||||
|
||||
equals( jQuery("#text1").attr("maxlength"), "30", "Check for maxlength attribute" );
|
||||
equals( jQuery("#text1").attr("maxLength"), "30", "Check for maxLength attribute" );
|
||||
equals( jQuery("#area1").attr("maxLength"), "30", "Check for maxLength attribute" );
|
||||
|
@ -92,6 +93,12 @@ test("attr(String)", function() {
|
|||
|
||||
body.removeAttribute("foo"); // Cleanup
|
||||
|
||||
var select = document.createElement("select"), optgroup = document.createElement("optgroup"), option = document.createElement("option");
|
||||
optgroup.appendChild( option );
|
||||
select.appendChild( optgroup );
|
||||
|
||||
equal( jQuery( option ).attr("selected"), "selected", "Make sure that a single option is selected, even when in an optgroup." );
|
||||
|
||||
var $img = jQuery("<img style='display:none' width='215' height='53' src='http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif'/>").appendTo("body");
|
||||
equals( $img.attr("width"), "215", "Retrieve width attribute an an element with display:none." );
|
||||
equals( $img.attr("height"), "53", "Retrieve height attribute an an element with display:none." );
|
||||
|
@ -109,17 +116,27 @@ test("attr(String)", function() {
|
|||
equals( jQuery("#table").attr("test:attrib"), undefined, "Retrieving a non-existent attribute on a table with a colon does not throw an error." );
|
||||
equals( jQuery("#table").attr("test:attrib", "foobar").attr("test:attrib"), "foobar", "Setting an attribute on a table with a colon does not throw an error." );
|
||||
|
||||
var $form = jQuery("<form class='something'></form>").appendTo("#qunit-fixture");
|
||||
equal( $form.attr("class"), "something", "Retrieve the class attribute on a form." );
|
||||
|
||||
var $a = jQuery("<a href='#' onclick='something()'>Click</a>").appendTo("#qunit-fixture");
|
||||
equal( $a.attr("onclick"), "something()", "Retrieve ^on attribute without anonymous function wrapper." );
|
||||
|
||||
ok( jQuery("<div/>").attr("doesntexist") === undefined, "Make sure undefined is returned when no attribute is found." );
|
||||
ok( jQuery("<div/>").attr("title") === undefined, "Make sure undefined is returned when no attribute is found." );
|
||||
equal( jQuery("<div/>").attr("title", "something").attr("title"), "something", "Set the title attribute." );
|
||||
ok( jQuery().attr("doesntexist") === undefined, "Make sure undefined is returned when no element is there." );
|
||||
equal( jQuery("<div/>").attr("value"), undefined, "An unset value on a div returns undefined." );
|
||||
equal( jQuery("<input/>").attr("value"), "", "An unset value on an input returns current value." );
|
||||
});
|
||||
|
||||
if ( !isLocal ) {
|
||||
test("attr(String) in XML Files", function() {
|
||||
expect(2);
|
||||
stop();
|
||||
jQuery.get("data/dashboard.xml", function(xml) {
|
||||
equals( jQuery("locations", xml).attr("class"), "foo", "Check class attribute in XML document" );
|
||||
equals( jQuery("location", xml).attr("for"), "bar", "Check for attribute in XML document" );
|
||||
jQuery.get("data/dashboard.xml", function( xml ) {
|
||||
equals( jQuery( "locations", xml ).attr("class"), "foo", "Check class attribute in XML document" );
|
||||
equals( jQuery( "location", xml ).attr("for"), "bar", "Check for attribute in XML document" );
|
||||
start();
|
||||
});
|
||||
});
|
||||
|
@ -144,7 +161,7 @@ test("attr(Hash)", function() {
|
|||
});
|
||||
|
||||
test("attr(String, Object)", function() {
|
||||
expect(59);
|
||||
expect(69);
|
||||
|
||||
var div = jQuery("div").attr("foo", "bar"),
|
||||
fail = false;
|
||||
|
@ -193,6 +210,11 @@ test("attr(String, Object)", function() {
|
|||
equals( jQuery("#check2").prop("checked"), false, "Set checked attribute" );
|
||||
equals( jQuery("#check2").attr("checked"), undefined, "Set checked attribute" );
|
||||
|
||||
jQuery("#check2").attr("checked", "checked");
|
||||
equal( document.getElementById("check2").checked, true, "Set checked attribute with 'checked'" );
|
||||
equal( jQuery("#check2").prop("checked"), true, "Set checked attribute" );
|
||||
equal( jQuery("#check2").attr("checked"), "checked", "Set checked attribute" );
|
||||
|
||||
jQuery("#text1").prop("readOnly", true);
|
||||
equals( document.getElementById("text1").readOnly, true, "Set readonly attribute" );
|
||||
equals( jQuery("#text1").prop("readOnly"), true, "Set readonly attribute" );
|
||||
|
@ -206,9 +228,6 @@ test("attr(String, Object)", function() {
|
|||
equals( document.getElementById("name").maxLength, 5, "Set maxlength attribute" );
|
||||
jQuery("#name").attr("maxLength", "10");
|
||||
equals( document.getElementById("name").maxLength, 10, "Set maxlength attribute" );
|
||||
var $p = jQuery("#firstp").attr("nonexisting", "foo");
|
||||
equals( $p.attr("nonexisting"), "foo", "attr(name, value) works correctly for non existing attributes (bug #7500).");
|
||||
$p.removeAttr("nonexisting");
|
||||
|
||||
var $text = jQuery("#text1").attr("autofocus", true);
|
||||
if ( "autofocus" in $text[0] ) {
|
||||
|
@ -227,12 +246,19 @@ test("attr(String, Object)", function() {
|
|||
|
||||
var attributeNode = document.createAttribute("irrelevant"),
|
||||
commentNode = document.createComment("some comment"),
|
||||
textNode = document.createTextNode("some text");
|
||||
|
||||
jQuery.each( [commentNode, textNode, attributeNode], function( i, ele ) {
|
||||
var $ele = jQuery( ele );
|
||||
$ele.attr( "nonexisting", "foo" );
|
||||
strictEqual( $ele.attr("nonexisting"), undefined, "attr(name, value) works correctly on comment and text nodes (bug #7500)." );
|
||||
textNode = document.createTextNode("some text"),
|
||||
obj = {};
|
||||
|
||||
jQuery.each( [commentNode, textNode, attributeNode], function( i, elem ) {
|
||||
var $elem = jQuery( elem );
|
||||
$elem.attr( "nonexisting", "foo" );
|
||||
strictEqual( $elem.attr("nonexisting"), undefined, "attr(name, value) works correctly on comment and text nodes (bug #7500)." );
|
||||
});
|
||||
|
||||
jQuery.each( [window, document, obj, "#firstp"], function( i, elem ) {
|
||||
var $elem = jQuery( elem );
|
||||
strictEqual( $elem.attr("nonexisting"), undefined, "attr works correctly for non existing attributes (bug #7500)." );
|
||||
equal( $elem.attr("something", "foo" ).attr("something"), "foo", "attr falls back to prop on unsupported arguments" );
|
||||
});
|
||||
|
||||
var table = jQuery("#table").append("<tr><td>cell</td></tr><tr><td>cell</td><td>cell</td></tr><tr><td>cell</td><td>cell</td></tr>"),
|
||||
|
@ -244,7 +270,7 @@ test("attr(String, Object)", function() {
|
|||
table.attr("cellspacing", "2");
|
||||
equals( table[0].cellSpacing, "2", "Check cellspacing is correctly set" );
|
||||
|
||||
equals( jQuery("#area1").attr("value"), undefined, "Value attribute retrieved correctly on textarea." );
|
||||
equals( jQuery("#area1").attr("value"), "foobar", "Value attribute retrieves the property for backwards compatibility." );
|
||||
|
||||
// for #1070
|
||||
jQuery("#name").attr("someAttr", "0");
|
||||
|
@ -262,7 +288,7 @@ test("attr(String, Object)", function() {
|
|||
j.removeAttr("name");
|
||||
|
||||
QUnit.reset();
|
||||
|
||||
|
||||
// Type
|
||||
var type = jQuery("#check2").attr("type");
|
||||
var thrown = false;
|
||||
|
@ -350,10 +376,10 @@ if ( !isLocal ) {
|
|||
test("attr(String, Object) - Loaded via XML document", function() {
|
||||
expect(2);
|
||||
stop();
|
||||
jQuery.get("data/dashboard.xml", function(xml) {
|
||||
jQuery.get("data/dashboard.xml", function( xml ) {
|
||||
var titles = [];
|
||||
jQuery("tab", xml).each(function() {
|
||||
titles.push(jQuery(this).attr("title"));
|
||||
jQuery( "tab", xml ).each(function() {
|
||||
titles.push( jQuery(this).attr("title") );
|
||||
});
|
||||
equals( titles[0], "Location", "attr() in XML context: Check first title" );
|
||||
equals( titles[1], "Users", "attr() in XML context: Check second title" );
|
||||
|
@ -424,7 +450,7 @@ test("removeAttr(String)", function() {
|
|||
equals( jQuery("#foo").attr("style", "position:absolute;").removeAttr("style").attr("style"), undefined, "Check removing style attribute" );
|
||||
equals( jQuery("#form").attr("style", "position:absolute;").removeAttr("style").attr("style"), undefined, "Check removing style attribute on a form" );
|
||||
equals( jQuery("#fx-test-group").attr("height", "3px").removeAttr("height").css("height"), "1px", "Removing height attribute has no effect on height set with style attribute" );
|
||||
|
||||
|
||||
jQuery("#check1").removeAttr("checked").prop("checked", true).removeAttr("checked");
|
||||
equals( document.getElementById("check1").checked, false, "removeAttr sets boolean properties to false" );
|
||||
jQuery("#text1").prop("readOnly", true).removeAttr("readonly");
|
||||
|
@ -581,10 +607,34 @@ test("val()", function() {
|
|||
var $button = jQuery("<button value='foobar'>text</button>").insertAfter("#button");
|
||||
equals( $button.val(), "foobar", "Value retrieval on a button does not return innerHTML" );
|
||||
equals( $button.val("baz").html(), "text", "Setting the value does not change innerHTML" );
|
||||
|
||||
|
||||
equals( jQuery("<option/>").val("test").attr("value"), "test", "Setting value sets the value attribute" );
|
||||
});
|
||||
|
||||
if ( "value" in document.createElement("meter") &&
|
||||
"value" in document.createElement("progress") ) {
|
||||
|
||||
test("val() respects numbers without exception (Bug #9319)", function() {
|
||||
|
||||
expect(4);
|
||||
|
||||
var $meter = jQuery("<meter min='0' max='10' value='5.6'></meter>"),
|
||||
$progress = jQuery("<progress max='10' value='1.5'></progress>");
|
||||
|
||||
try {
|
||||
equal( typeof $meter.val(), "number", "meter, returns a number and does not throw exception" );
|
||||
equal( $meter.val(), $meter[0].value, "meter, api matches host and does not throw exception" );
|
||||
|
||||
equal( typeof $progress.val(), "number", "progress, returns a number and does not throw exception" );
|
||||
equal( $progress.val(), $progress[0].value, "progress, api matches host and does not throw exception" );
|
||||
|
||||
} catch(e) {}
|
||||
|
||||
$meter.remove();
|
||||
$progress.remove();
|
||||
});
|
||||
}
|
||||
|
||||
var testVal = function(valueObj) {
|
||||
expect(8);
|
||||
|
||||
|
@ -708,7 +758,7 @@ test("val(select) after form.reset() (Bug #2551)", function() {
|
|||
same( jQuery("#select3").val(), ["1", "2"], "Call val() on a multiple=\"multiple\" select" );
|
||||
|
||||
jQuery("#kk").remove();
|
||||
});
|
||||
});
|
||||
|
||||
var testAddClass = function(valueObj) {
|
||||
expect(5);
|
||||
|
@ -752,7 +802,7 @@ test("addClass(Function) with incoming value", function() {
|
|||
var div = jQuery("div"), old = div.map(function(){
|
||||
return jQuery(this).attr("class") || "";
|
||||
});
|
||||
|
||||
|
||||
div.addClass(function(i, val) {
|
||||
if ( this.id !== "_firebugConsole") {
|
||||
equals( val, old[i], "Make sure the incoming value is correct." );
|
||||
|
|
|
@ -109,11 +109,13 @@ test("css(String|Hash)", function() {
|
|||
});
|
||||
|
||||
test("css() explicit and relative values", function() {
|
||||
expect(9);
|
||||
expect(27);
|
||||
var $elem = jQuery("#nothiddendiv");
|
||||
|
||||
$elem.css({ width: 1, height: 1 });
|
||||
$elem.css({ width: 1, height: 1, paddingLeft: "1px", opacity: 1 });
|
||||
equals( $elem.width(), 1, "Initial css set or width/height works (hash)" );
|
||||
equals( $elem.css("paddingLeft"), "1px", "Initial css set of paddingLeft works (hash)" );
|
||||
equals( $elem.css("opacity"), "1", "Initial css set of opacity works (hash)" );
|
||||
|
||||
$elem.css({ width: "+=9" });
|
||||
equals( $elem.width(), 10, "'+=9' on width (hash)" );
|
||||
|
@ -138,6 +140,54 @@ test("css() explicit and relative values", function() {
|
|||
|
||||
$elem.css( "width", "-=9px" );
|
||||
equals( $elem.width(), 1, "'-=9px' on width (params)" );
|
||||
|
||||
$elem.css({ paddingLeft: "+=4" });
|
||||
equals( $elem.css("paddingLeft"), "5px", "'+=4' on paddingLeft (hash)" );
|
||||
|
||||
$elem.css({ paddingLeft: "-=4" });
|
||||
equals( $elem.css("paddingLeft"), "1px", "'-=4' on paddingLeft (hash)" );
|
||||
|
||||
$elem.css({ paddingLeft: "+=4px" });
|
||||
equals( $elem.css("paddingLeft"), "5px", "'+=4px' on paddingLeft (hash)" );
|
||||
|
||||
$elem.css({ paddingLeft: "-=4px" });
|
||||
equals( $elem.css("paddingLeft"), "1px", "'-=4px' on paddingLeft (hash)" );
|
||||
|
||||
$elem.css({ "padding-left": "+=4" });
|
||||
equals( $elem.css("paddingLeft"), "5px", "'+=4' on padding-left (hash)" );
|
||||
|
||||
$elem.css({ "padding-left": "-=4" });
|
||||
equals( $elem.css("paddingLeft"), "1px", "'-=4' on padding-left (hash)" );
|
||||
|
||||
$elem.css({ "padding-left": "+=4px" });
|
||||
equals( $elem.css("paddingLeft"), "5px", "'+=4px' on padding-left (hash)" );
|
||||
|
||||
$elem.css({ "padding-left": "-=4px" });
|
||||
equals( $elem.css("paddingLeft"), "1px", "'-=4px' on padding-left (hash)" );
|
||||
|
||||
$elem.css( "paddingLeft", "+=4" );
|
||||
equals( $elem.css("paddingLeft"), "5px", "'+=4' on paddingLeft (params)" );
|
||||
|
||||
$elem.css( "paddingLeft", "-=4" );
|
||||
equals( $elem.css("paddingLeft"), "1px", "'-=4' on paddingLeft (params)" );
|
||||
|
||||
$elem.css( "padding-left", "+=4px" );
|
||||
equals( $elem.css("paddingLeft"), "5px", "'+=4px' on padding-left (params)" );
|
||||
|
||||
$elem.css( "padding-left", "-=4px" );
|
||||
equals( $elem.css("paddingLeft"), "1px", "'-=4px' on padding-left (params)" );
|
||||
|
||||
$elem.css({ opacity: "-=0.5" });
|
||||
equals( $elem.css("opacity"), "0.5", "'-=0.5' on opacity (hash)" );
|
||||
|
||||
$elem.css({ opacity: "+=0.5" });
|
||||
equals( $elem.css("opacity"), "1", "'+=0.5' on opacity (hash)" );
|
||||
|
||||
$elem.css( "opacity", "-=0.5" );
|
||||
equals( $elem.css("opacity"), "0.5", "'-=0.5' on opacity (params)" );
|
||||
|
||||
$elem.css( "opacity", "+=0.5" );
|
||||
equals( $elem.css("opacity"), "1", "'+=0.5' on opacity (params)" );
|
||||
});
|
||||
|
||||
test("css(String, Object)", function() {
|
||||
|
|
|
@ -488,7 +488,7 @@ if (window.JSON && window.JSON.stringify) {
|
|||
}
|
||||
|
||||
test("jQuery.data should follow html5 specification regarding camel casing", function() {
|
||||
expect(6);
|
||||
expect(8);
|
||||
|
||||
var div = jQuery("<div id='myObject' data-foo='a' data-foo-bar='b' data-foo-bar-baz='c'></div>")
|
||||
.prependTo("body");
|
||||
|
@ -501,5 +501,10 @@ test("jQuery.data should follow html5 specification regarding camel casing", fun
|
|||
equals(div.data("fooBar"), "b", "Verify multiple word data-* key");
|
||||
equals(div.data("fooBarBaz"), "c", "Verify multiple word data-* key");
|
||||
|
||||
div.data("foo-bar", "d");
|
||||
|
||||
equals(div.data("fooBar"), "d", "Verify updated data-* key");
|
||||
equals(div.data("foo-bar"), "d", "Verify updated data-* key");
|
||||
|
||||
div.remove();
|
||||
});
|
||||
});
|
||||
|
|
16
test/unit/effects.js
vendored
16
test/unit/effects.js
vendored
|
@ -1029,3 +1029,19 @@ test( "animate properties missing px w/ opacity as last (#9074)", 2, function()
|
|||
start();
|
||||
}, 100);
|
||||
});
|
||||
|
||||
test("callbacks should fire in correct order (#9100)", function() {
|
||||
stop();
|
||||
var a = 1,
|
||||
cb = 0,
|
||||
$lis = jQuery("<p data-operation='*2'></p><p data-operation='^2'></p>").appendTo("#qunit-fixture")
|
||||
// The test will always pass if no properties are animated or if the duration is 0
|
||||
.animate({fontSize: 12}, 13, function() {
|
||||
a *= jQuery(this).data("operation") === "*2" ? 2 : a;
|
||||
cb++;
|
||||
if ( cb === 2 ) {
|
||||
equal( a, 4, "test value has been *2 and _then_ ^2");
|
||||
start();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -14,6 +14,26 @@ test("null or undefined handler", function() {
|
|||
} catch (e) {}
|
||||
});
|
||||
|
||||
test("bind(),live(),delegate() with non-null,defined data", function() {
|
||||
|
||||
expect(3);
|
||||
|
||||
var handler = function( event, data ) {
|
||||
equal( data, 0, "non-null, defined data (zero) is correctly passed" );
|
||||
};
|
||||
|
||||
jQuery("#foo").bind("foo", handler);
|
||||
jQuery("#foo").live("foo", handler);
|
||||
jQuery("div").delegate("#foo", "foo", handler);
|
||||
|
||||
jQuery("#foo").trigger("foo", 0);
|
||||
|
||||
jQuery("#foo").unbind("foo", handler);
|
||||
jQuery("#foo").die("foo", handler);
|
||||
jQuery("div").undelegate("#foo", "foo");
|
||||
|
||||
});
|
||||
|
||||
test("bind(), with data", function() {
|
||||
expect(4);
|
||||
var handler = function(event) {
|
||||
|
|
|
@ -1044,7 +1044,7 @@ test("clone(form element) (Bug #3879, #6655)", function() {
|
|||
|
||||
equals( clone.is(":checked"), element.is(":checked"), "Checked input cloned correctly" );
|
||||
equals( clone[0].defaultValue, "foo", "Checked input defaultValue cloned correctly" );
|
||||
|
||||
|
||||
// defaultChecked also gets set now due to setAttribute in attr, is this check still valid?
|
||||
// equals( clone[0].defaultChecked, !jQuery.support.noCloneChecked, "Checked input defaultChecked cloned correctly" );
|
||||
|
||||
|
@ -1393,6 +1393,41 @@ test("jQuery.buildFragment - no plain-text caching (Bug #6779)", function() {
|
|||
}
|
||||
catch(e) {}
|
||||
}
|
||||
equals($f.text(), bad.join(""), "Cached strings that match Object properties");
|
||||
equals($f.text(), bad.join(""), "Cached strings that match Object properties");
|
||||
$f.remove();
|
||||
});
|
||||
|
||||
test( "jQuery.html - execute scripts escaped with html comment or CDATA (#9221)", function() {
|
||||
expect( 3 );
|
||||
jQuery( [
|
||||
'<script type="text/javascript">',
|
||||
'<!--',
|
||||
'ok( true, "<!-- handled" );',
|
||||
'//-->',
|
||||
'</script>'
|
||||
].join ( "\n" ) ).appendTo( "#qunit-fixture" );
|
||||
jQuery( [
|
||||
'<script type="text/javascript">',
|
||||
'<![CDATA[',
|
||||
'ok( true, "<![CDATA[ handled" );',
|
||||
'//]]>',
|
||||
'</script>'
|
||||
].join ( "\n" ) ).appendTo( "#qunit-fixture" );
|
||||
jQuery( [
|
||||
'<script type="text/javascript">',
|
||||
'<!--//--><![CDATA[//><!--',
|
||||
'ok( true, "<!--//--><![CDATA[//><!-- (Drupal case) handled" );',
|
||||
'//--><!]]>',
|
||||
'</script>'
|
||||
].join ( "\n" ) ).appendTo( "#qunit-fixture" );
|
||||
});
|
||||
|
||||
test("jQuery.buildFragment - plain objects are not a document #8950", function() {
|
||||
expect(1);
|
||||
|
||||
try {
|
||||
jQuery('<input type="hidden">', {});
|
||||
ok( true, "Does not allow attribute object to be treated like a doc object");
|
||||
} catch (e) {}
|
||||
|
||||
});
|
||||
|
|
|
@ -107,7 +107,31 @@ test("queue() passes in the next item in the queue as a parameter to fx queues",
|
|||
equals(counter, 2, "Deferreds resolved");
|
||||
start();
|
||||
});
|
||||
});
|
||||
|
||||
test("callbacks keep their place in the queue", function() {
|
||||
expect(5);
|
||||
stop();
|
||||
var div = jQuery("<div>"),
|
||||
counter = 0;
|
||||
|
||||
div.queue(function( next ) {
|
||||
equal( ++counter, 1, "Queue/callback order: first called" );
|
||||
setTimeout( next, 200 );
|
||||
}).show(100, function() {
|
||||
equal( ++counter, 2, "Queue/callback order: second called" );
|
||||
jQuery(this).hide(100, function() {
|
||||
equal( ++counter, 4, "Queue/callback order: fourth called" );
|
||||
});
|
||||
}).queue(function( next ) {
|
||||
equal( ++counter, 3, "Queue/callback order: third called" );
|
||||
next();
|
||||
});
|
||||
|
||||
div.promise("fx").done(function() {
|
||||
equals(counter, 4, "Deferreds resolved");
|
||||
start();
|
||||
});
|
||||
});
|
||||
|
||||
test("delay()", function() {
|
||||
|
|
55
test/unit/support.js
Normal file
55
test/unit/support.js
Normal file
|
@ -0,0 +1,55 @@
|
|||
module("support", { teardown: moduleTeardown });
|
||||
|
||||
function supportIFrameTest( title, url, noDisplay, func ) {
|
||||
|
||||
if ( noDisplay !== true ) {
|
||||
func = noDisplay;
|
||||
noDisplay = false;
|
||||
}
|
||||
|
||||
test( title, function() {
|
||||
var iframe;
|
||||
|
||||
stop();
|
||||
window.supportCallback = function() {
|
||||
var self = this,
|
||||
args = arguments;
|
||||
setTimeout( function() {
|
||||
window.supportCallback = undefined;
|
||||
iframe.remove();
|
||||
func.apply( self, args );
|
||||
start();
|
||||
}, 0 );
|
||||
};
|
||||
iframe = jQuery( "<div/>" ).css( "display", noDisplay ? "none" : "block" ).append(
|
||||
jQuery( "<iframe/>" ).attr( "src", "data/support/" + url + ".html" )
|
||||
).appendTo( "body" );
|
||||
});
|
||||
}
|
||||
|
||||
supportIFrameTest( "proper boxModel in compatMode CSS1Compat (IE6 and IE7)", "boxModelIE", function( compatMode, boxModel ) {
|
||||
ok( compatMode !== "CSS1Compat" || boxModel, "boxModel properly detected" );
|
||||
});
|
||||
|
||||
supportIFrameTest( "body background is not lost if set prior to loading jQuery (#9238)", "bodyBackground", function( color, support ) {
|
||||
expect( 2 );
|
||||
var okValue = {
|
||||
"#000000": true,
|
||||
"rgb(0, 0, 0)": true
|
||||
};
|
||||
ok( okValue[ color ], "color was not reset (" + color + ")" );
|
||||
var i, passed = true;
|
||||
for ( i in jQuery.support ) {
|
||||
if ( jQuery.support[ i ] !== support[ i ] ) {
|
||||
passed = false;
|
||||
strictEquals( jQuery.support[ i ], support[ i ], "Support property " + i + " is different" );
|
||||
}
|
||||
}
|
||||
for ( i in support ) {
|
||||
if ( !( i in jQuery.support ) ) {
|
||||
ok = false;
|
||||
strictEquals( src[ i ], dest[ i ], "Unexpected property: " + i );
|
||||
}
|
||||
}
|
||||
ok( passed, "Same support properties" );
|
||||
});
|
|
@ -1 +1 @@
|
|||
1.6.1pre
|
||||
1.6.2pre
|
Loading…
Reference in a new issue