Compare commits

...

30 Commits

Author SHA1 Message Date
Denis Knauf bb7d98f018 input type=datetime-local support for ajax. 2011-07-07 12:13:10 +02:00
jaubourg e6f8951983 Fixes #9632. Adds res:// protocol to the list of local protocols. 2011-07-01 02:18:05 +02:00
jaubourg e83fcdcb02 Fixes #9682. Removes data from the options for request with no content so that it is not used again in case of a retry. Unit test added. 2011-07-01 02:11:26 +02:00
jaubourg 139135a98a Fixes #9446. Context is properly propagated using pipe. If context was the original deferred, then context is updated to next deferred in the chain. Unit tests added. 2011-07-01 01:51:50 +02:00
jaubourg 5b92a5f5ec Replaces typo (status instead of state) as observed in #9585. 2011-07-01 00:16:34 +02:00
John Resig e2ab2ba1d5 Updating the source version to 1.6.3pre 2011-06-30 14:17:44 -04:00
John Resig aa6f8c8cd3 Tagging the 1.6.2 release. 2011-06-30 14:16:56 -04:00
timmywil ab1504f14f Set timerId to true instead of a number so that intervals set to 1 are not accidentally cleared when stopped. Fixes #9678.
- Adding a working test case would not be possible in this case, but all tests pass.
2011-06-28 11:46:03 -04:00
timmywil 96501d38a9 Allow similarly named classes (regression from 9499) and switch class retrieval to property when passing class to value functions. Fixes #9617. 2011-06-19 18:58:47 -04:00
Mike Sherov 124817e668 Landing pull request 413. Move border/padding checks to after width validation to avoid unnecessary fallbacks. Fixes #9598.
More Details:
 - https://github.com/jquery/jquery/pull/413
 - http://bugs.jquery.com/ticket/9300
 - http://bugs.jquery.com/ticket/9441
 - http://bugs.jquery.com/ticket/9598
2011-06-17 17:33:29 -04:00
John Resig d59b0f3e27 Re-updating QUnit, oops. 2011-06-14 15:06:28 -07:00
John Resig d269e426e0 Updating version in release notes script. 2011-06-14 15:05:27 -07:00
John Resig 138d5b7b81 Updating the source version to 1.6.2pre 2011-06-14 14:55:14 -07:00
John Resig d443e533aa Tagging the 1.6.2rc1 release. 2011-06-14 14:54:23 -07:00
Schalk Neethling 8a532d1575 Landing pull request 378. Comment typo in core.js.
More Details:
 - https://github.com/jquery/jquery/pull/378
2011-06-14 16:01:50 -04:00
rwldrn 5eef5917fd Landing pull request 409. Adds fillOpacity to internal cssNumber. Fixes #9548.
More Details:
 - https://github.com/jquery/jquery/pull/409
 - http://bugs.jquery.com/ticket/9548
2011-06-14 15:59:22 -04:00
Greg Hazel 13ceb0f56b Landing pull request 410. Moves jQuery attachment comment to outro.
More Details:
 - https://github.com/jquery/jquery/pull/410
2011-06-14 15:51:03 -04:00
rwldrn 6926247bf4 Landing pull request 397. withinElement rewrite in event. Fixes #6234, #9357, #9447.
More Details:
 - https://github.com/jquery/jquery/pull/397
 - http://bugs.jquery.com/ticket/6234
 - http://bugs.jquery.com/ticket/9357
 - http://bugs.jquery.com/ticket/9447
2011-06-14 15:38:46 -04:00
timmywil 641ad80211 Attribute hooks do not need to be attached in XML docs. Fixes #9568. 2011-06-13 10:02:13 -04:00
timmywil 39a2f29c29 Revert "Add catch block to try/finally in deferred. Fixes #9033. Test case needed." Line of exception was lost when debugging.
This reverts commit 0a80be67f4.
2011-06-08 10:55:52 -04:00
timmywil db437be6e3 Check classes passed for duplicates. Fixes #9499. 2011-06-07 21:00:44 -04:00
timmywil 0a80be67f4 Add catch block to try/finally in deferred. Fixes #9033. Test case needed. 2011-06-07 20:55:17 -04:00
timmywil d66c3b6d84 Remove fellback in width/height cssHook 2011-06-07 00:04:17 -04:00
rwldrn 6490c10c75 Landing pull request 401. Nulling all elements created in support.js; Fixes #9471.
More Details:
 - https://github.com/jquery/jquery/pull/401
 - http://bugs.jquery.com/ticket/9471
2011-06-06 23:54:17 -04:00
timmywil 75203de743 Optimize width/height retrieval (moved logic to getWH, removed adjustWH). Supplements #9441, #9300. 2011-06-06 23:35:16 -04:00
Mike Sherov 80ad14bd14 Add margin after checking width. Add tests. Fixes #9441. Fixes #9300. 2011-06-06 23:13:37 -04:00
rwldrn 0742056645 Landing pull request 403. Check for both camelized and hyphenated data property names; Fixes #9301.
More Details:
 - https://github.com/jquery/jquery/pull/403
 - http://bugs.jquery.com/ticket/9301
2011-06-06 20:18:36 -04:00
rwldrn c3c001cf5b Landing pull request 404. Removes unused hasOwn var declaration. Fixes #9510.
More Details:
 - https://github.com/jquery/jquery/pull/404
 - http://bugs.jquery.com/ticket/9510
2011-06-06 20:16:14 -04:00
timmywil 71d2e657d0 Update QUnit. 2011-06-06 20:15:16 -04:00
timmywil 1d202c6afc Move the value attrHook to the main attrHooks object to save bytes 2011-05-26 16:51:41 -04:00
23 changed files with 307 additions and 157 deletions

View File

@ -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.1 RC 1",
short_version: "1.6rc1",
final_version: "1.6.1",
version: "1.6.2 RC 1",
short_version: "1.6.2rc1",
final_version: "1.6.2",
categories: []
};

View File

@ -5,9 +5,9 @@ var r20 = /%20/g,
rCRLF = /\r?\n/g,
rhash = /#.*$/,
rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
// #7653, #8125, #8152: local protocol detection
rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|widget):$/,
rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,
rnoContent = /^(?:GET|HEAD)$/,
rprotocol = /^\/\//,
rquery = /\?/,
@ -644,6 +644,8 @@ jQuery.extend({
// If data is available, append data to url
if ( s.data ) {
s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data;
// #9682: remove data so that it's not used in an eventual retry
delete s.data;
}
// Get ifModifiedKey before adding the anti-cache parameter
@ -727,7 +729,7 @@ jQuery.extend({
transport.send( requestHeaders, done );
} catch (e) {
// Propagate exception as error if not done
if ( status < 2 ) {
if ( state < 2 ) {
done( -1, e );
// Simply rethrow otherwise
} else {

View File

@ -37,30 +37,31 @@ jQuery.fn.extend({
},
addClass: function( value ) {
var classNames, i, l, elem,
setClass, c, cl;
if ( jQuery.isFunction( value ) ) {
return this.each(function(i) {
var self = jQuery(this);
self.addClass( value.call(this, i, self.attr("class") || "") );
return this.each(function( j ) {
jQuery( this ).addClass( value.call(this, j, this.className) );
});
}
if ( value && typeof value === "string" ) {
var classNames = (value || "").split( rspace );
classNames = value.split( rspace );
for ( var i = 0, l = this.length; i < l; i++ ) {
var elem = this[i];
for ( i = 0, l = this.length; i < l; i++ ) {
elem = this[ i ];
if ( elem.nodeType === 1 ) {
if ( !elem.className ) {
if ( !elem.className && classNames.length === 1 ) {
elem.className = value;
} else {
var className = " " + elem.className + " ",
setClass = elem.className;
setClass = " " + elem.className + " ";
for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) {
setClass += " " + classNames[c];
for ( c = 0, cl = classNames.length; c < cl; c++ ) {
if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) {
setClass += classNames[ c ] + " ";
}
}
elem.className = jQuery.trim( setClass );
@ -73,24 +74,25 @@ jQuery.fn.extend({
},
removeClass: function( value ) {
if ( jQuery.isFunction(value) ) {
return this.each(function(i) {
var self = jQuery(this);
self.removeClass( value.call(this, i, self.attr("class")) );
var classNames, i, l, elem, className, c, cl;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).removeClass( value.call(this, j, this.className) );
});
}
if ( (value && typeof value === "string") || value === undefined ) {
var classNames = (value || "").split( rspace );
classNames = (value || "").split( rspace );
for ( var i = 0, l = this.length; i < l; i++ ) {
var elem = this[i];
for ( i = 0, l = this.length; i < l; i++ ) {
elem = this[ i ];
if ( elem.nodeType === 1 && elem.className ) {
if ( value ) {
var className = (" " + elem.className + " ").replace(rclass, " ");
for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
className = className.replace(" " + classNames[c] + " ", " ");
className = (" " + elem.className + " ").replace( rclass, " " );
for ( c = 0, cl = classNames.length; c < cl; c++ ) {
className = className.replace(" " + classNames[ c ] + " ", " ");
}
elem.className = jQuery.trim( className );
@ -109,9 +111,8 @@ jQuery.fn.extend({
isBool = typeof stateVal === "boolean";
if ( jQuery.isFunction( value ) ) {
return this.each(function(i) {
var self = jQuery(this);
self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal );
return this.each(function( i ) {
jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
});
}
@ -317,21 +318,23 @@ jQuery.extend({
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
// Normalize the name if needed
name = notxml && jQuery.attrFix[ name ] || name;
if ( notxml ) {
name = jQuery.attrFix[ name ] || name;
hooks = jQuery.attrHooks[ name ];
hooks = jQuery.attrHooks[ name ];
if ( !hooks ) {
// Use boolHook for boolean attributes
if ( rboolean.test( name ) ) {
if ( !hooks ) {
// Use boolHook for boolean attributes
if ( rboolean.test( name ) ) {
hooks = boolHook;
hooks = boolHook;
// Use formHook for forms and if the name contains certain characters
} else if ( formHook && name !== "className" &&
(jQuery.nodeName( elem, "form" ) || rinvalidChar.test( name )) ) {
// Use formHook for forms and if the name contains certain characters
} else if ( formHook && name !== "className" &&
(jQuery.nodeName( elem, "form" ) || rinvalidChar.test( name )) ) {
hooks = formHook;
hooks = formHook;
}
}
}
@ -414,6 +417,25 @@ jQuery.extend({
0 :
undefined;
}
},
// Use the value property for back compat
// Use the formHook for button elements in IE6/7 (#1954)
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;
}
}
},
@ -443,10 +465,11 @@ jQuery.extend({
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 ( notxml ) {
// Fix name and attach hooks
name = jQuery.propFix[ name ] || name;
hooks = jQuery.propHooks[ name ];
}
if ( value !== undefined ) {
if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
@ -497,26 +520,6 @@ 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 ) {

View File

@ -792,7 +792,7 @@ jQuery.extend({
},
// Mutifunctional method to get and set values to a collection
// The value/s can be optionally by executed if its a function
// The value/s can optionally be executed if it's a function
access: function( elems, key, value, exec, fn, pass ) {
var length = elems.length;
@ -923,7 +923,6 @@ function doScrollCheck() {
jQuery.ready();
}
// Expose jQuery to the global object
return jQuery;
})();

View File

@ -50,13 +50,14 @@ jQuery.extend({
// Exclude the following css properties to add px
cssNumber: {
"zIndex": true,
"fillOpacity": true,
"fontWeight": true,
"opacity": true,
"zoom": true,
"lineHeight": true,
"opacity": true,
"orphans": true,
"widows": true,
"orphans": true
"zIndex": true,
"zoom": true
},
// Add in properties whose names you wish to fix before
@ -172,43 +173,21 @@ jQuery.each(["height", "width"], function( i, name ) {
if ( computed ) {
if ( elem.offsetWidth !== 0 ) {
val = getWH( elem, name, extra );
return getWH( elem, name, extra );
} else {
jQuery.swap( elem, cssShow, function() {
val = getWH( elem, name, extra );
});
}
if ( val <= 0 ) {
val = curCSS( elem, name, name );
if ( val === "0px" && currentStyle ) {
val = currentStyle( elem, name, name );
}
if ( val != null ) {
// Should return "auto" instead of 0, use 0 for
// temporary backwards-compat
return val === "" || val === "auto" ? "0px" : val;
}
}
if ( val < 0 || val == null ) {
val = elem.style[ name ];
// Should return "auto" instead of 0, use 0 for
// temporary backwards-compat
return val === "" || val === "auto" ? "0px" : val;
}
return typeof val === "string" ? val : val + "px";
return val;
}
},
set: function( elem, value ) {
if ( rnumpx.test( value ) ) {
// ignore negative width and height values #1599
value = parseFloat(value);
value = parseFloat( value );
if ( value >= 0 ) {
return value + "px";
@ -331,27 +310,50 @@ if ( document.documentElement.currentStyle ) {
curCSS = getComputedStyle || currentStyle;
function getWH( elem, name, extra ) {
var which = name === "width" ? cssWidth : cssHeight,
val = name === "width" ? elem.offsetWidth : elem.offsetHeight;
if ( extra === "border" ) {
return val;
// Start with offset property
var val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
which = name === "width" ? cssWidth : cssHeight;
if ( val > 0 ) {
if ( extra !== "border" ) {
jQuery.each( which, function() {
if ( !extra ) {
val -= parseFloat( jQuery.css( elem, "padding" + this ) ) || 0;
}
if ( extra === "margin" ) {
val += parseFloat( jQuery.css( elem, extra + this ) ) || 0;
} else {
val -= parseFloat( jQuery.css( elem, "border" + this + "Width" ) ) || 0;
}
});
}
return val + "px";
}
jQuery.each( which, function() {
if ( !extra ) {
val -= parseFloat(jQuery.css( elem, "padding" + this )) || 0;
}
// Fall back to computed then uncomputed css if necessary
val = curCSS( elem, name, name );
if ( val < 0 || val == null ) {
val = elem.style[ name ] || 0;
}
// Normalize "", auto, and prepare for extra
val = parseFloat( val ) || 0;
if ( extra === "margin" ) {
val += parseFloat(jQuery.css( elem, "margin" + this )) || 0;
// Add padding, border, margin
if ( extra ) {
jQuery.each( which, function() {
val += parseFloat( jQuery.css( elem, "padding" + this ) ) || 0;
if ( extra !== "padding" ) {
val += parseFloat( jQuery.css( elem, "border" + this + "Width" ) ) || 0;
}
if ( extra === "margin" ) {
val += parseFloat( jQuery.css( elem, extra + this ) ) || 0;
}
});
}
} else {
val -= parseFloat(jQuery.css( elem, "border" + this + "Width" )) || 0;
}
});
return val;
return val + "px";
}
if ( jQuery.expr && jQuery.expr.filters ) {

View File

@ -108,7 +108,10 @@ jQuery.extend({
return thisCache[ internalKey ] && thisCache[ internalKey ].events;
}
return getByName ? thisCache[ jQuery.camelCase( name ) ] : thisCache;
return getByName ?
// Check for both converted-to-camel and non-converted data property names
thisCache[ jQuery.camelCase( name ) ] || thisCache[ name ] :
thisCache;
},
removeData: function( elem, name, pvt /* Internal Use Only */ ) {

View File

@ -122,7 +122,7 @@ jQuery.extend({
if ( returned && jQuery.isFunction( returned.promise ) ) {
returned.promise().then( newDefer.resolve, newDefer.reject );
} else {
newDefer[ action ]( returned );
newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] );
}
});
} else {

View File

@ -1,12 +1,12 @@
(function( jQuery ) {
// Create innerHeight, innerWidth, outerHeight and outerWidth methods
// Create width, height, innerHeight, innerWidth, outerHeight and outerWidth methods
jQuery.each([ "Height", "Width" ], function( i, name ) {
var type = name.toLowerCase();
// innerHeight and innerWidth
jQuery.fn["inner" + name] = function() {
jQuery.fn[ "inner" + name ] = function() {
var elem = this[0];
return elem && elem.style ?
parseFloat( jQuery.css( elem, type, "padding" ) ) :
@ -14,7 +14,7 @@ jQuery.each([ "Height", "Width" ], function( i, name ) {
};
// outerHeight and outerWidth
jQuery.fn["outer" + name] = function( margin ) {
jQuery.fn[ "outer" + name ] = function( margin ) {
var elem = this[0];
return elem && elem.style ?
parseFloat( jQuery.css( elem, type, margin ? "margin" : "border" ) ) :

6
src/effects.js vendored
View File

@ -15,8 +15,8 @@ var elemdisplay = {},
],
fxNow,
requestAnimationFrame = window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame;
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame;
jQuery.fn.extend({
show: function( speed, easing, callback ) {
@ -411,7 +411,7 @@ jQuery.fx.prototype = {
if ( t() && jQuery.timers.push(t) && !timerId ) {
// Use requestAnimationFrame instead of setInterval if available
if ( requestAnimationFrame ) {
timerId = 1;
timerId = true;
raf = function() {
// When timerId gets set to null at any point, this stops
if ( timerId ) {

View File

@ -1,7 +1,6 @@
(function( jQuery ) {
var hasOwn = Object.prototype.hasOwnProperty,
rnamespaces = /\.(.*)$/,
var rnamespaces = /\.(.*)$/,
rformElems = /^(?:textarea|input|select)$/i,
rperiod = /\./g,
rspaces = / /g,
@ -651,34 +650,27 @@ jQuery.Event.prototype = {
// Checks if an event happened on an element within another element
// Used in jQuery.event.special.mouseenter and mouseleave handlers
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
// Check if mouse(over|out) are still within the same parent element
var related = event.relatedTarget,
inside = false,
eventType = event.type;
event.type = event.data;
// Firefox sometimes assigns relatedTarget a XUL element
// which we cannot access the parentNode property of
try {
if ( related !== this ) {
// Chrome does something similar, the parentNode property
// can be accessed but is null.
if ( parent && parent !== document && !parent.parentNode ) {
return;
if ( related ) {
inside = jQuery.contains( this, related );
}
// Traverse up the tree
while ( parent && parent !== this ) {
parent = parent.parentNode;
}
if ( !inside ) {
if ( parent !== this ) {
// handle event if we actually just moused on to a non sub-element
jQuery.event.handle.apply( this, arguments );
}
// assuming we've left the element since we most likely mousedover a xul element
} catch(e) { }
event.type = eventType;
}
}
},
// In case of event delegation, we only need to rename the event.type,

View File

@ -1,2 +1,3 @@
// Expose jQuery to the global object
window.jQuery = window.$ = jQuery;
})(window);

View File

@ -245,7 +245,7 @@ jQuery.support = (function() {
}
// Null connected elements to avoid leaks in IE
marginDiv = div = input = null;
testElement = fragment = select = opt = body = marginDiv = div = input = null;
return support;
})();

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<dashboard>
<locations class="foo">
<location for="bar">
<location for="bar" checked="different">
<infowindowtab>
<tab title="Location"><![CDATA[blabla]]></tab>
<tab title="Users"><![CDATA[blublu]]></tab>

View File

@ -119,5 +119,5 @@ sup { display: none; }
dfn { display: none; }
/* #9239 Attach a background to the body( avoid crashes in removing the test element in support ) */
body, div { background: url(http://www.ctemploymentlawblog.com/test.jpg) no-repeat -1000px 0; }
body, div { background: url(http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif) no-repeat -1000px 0; }

@ -1 +1 @@
Subproject commit d97b37ec322136406790e75d03333559f38bbecb
Subproject commit d4f23f8a882d13b71768503e2db9fa33ef169ba0

View File

@ -321,25 +321,40 @@ test("jQuery.ajax() - responseText on error", function() {
test(".ajax() - retry with jQuery.ajax( this )", function() {
expect( 1 );
expect( 2 );
stop();
var firstTime = 1;
var firstTime = true,
previousUrl;
jQuery.ajax({
url: url("data/errorWithText.php"),
error: function() {
if ( firstTime ) {
firstTime = 0;
firstTime = false;
jQuery.ajax( this );
} else {
ok( true , "Test retrying with jQuery.ajax(this) works" );
start();
jQuery.ajax({
url: url("data/errorWithText.php"),
data: { x: 1 },
beforeSend: function() {
if ( !previousUrl ) {
previousUrl = this.url;
} else {
strictEqual( this.url , previousUrl, "url parameters are not re-appended" );
start();
return false;
}
},
error: function() {
jQuery.ajax( this );
}
});
}
}
});
});
test(".ajax() - headers" , function() {

View File

@ -132,11 +132,12 @@ test("attr(String)", function() {
if ( !isLocal ) {
test("attr(String) in XML Files", function() {
expect(2);
expect(3);
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" );
equal( jQuery( "locations", xml ).attr("class"), "foo", "Check class attribute in XML document" );
equal( jQuery( "location", xml ).attr("for"), "bar", "Check for attribute in XML document" );
equal( jQuery( "location", xml ).attr("checked"), "different", "Check that hooks are not attached in XML document" );
start();
});
});
@ -761,12 +762,15 @@ test("val(select) after form.reset() (Bug #2551)", function() {
});
var testAddClass = function(valueObj) {
expect(5);
expect(9);
var div = jQuery("div");
div.addClass( valueObj("test") );
var pass = true;
for ( var i = 0; i < div.size(); i++ ) {
if ( div.get(i).className.indexOf("test") == -1 ) pass = false;
if ( !~div.get(i).className.indexOf("test") ) {
pass = false;
}
}
ok( pass, "Add Class" );
@ -787,6 +791,19 @@ var testAddClass = function(valueObj) {
div.attr("class", "foo");
div.addClass( valueObj("bar baz") );
equals( div.attr("class"), "foo bar baz", "Make sure there isn't too much trimming." );
div.removeClass();
div.addClass( valueObj("foo") ).addClass( valueObj("foo") )
equal( div.attr("class"), "foo", "Do not add the same class twice in separate calls." );
div.addClass( valueObj("fo") );
equal( div.attr("class"), "foo fo", "Adding a similar class does not get interrupted." );
div.removeClass().addClass("wrap2");
ok( div.addClass("wrap").hasClass("wrap"), "Can add similarly named classes");
div.removeClass();
div.addClass( valueObj("bar bar") );
equal( div.attr("class"), "bar", "Do not add the same class twice in the same call." );
};
test("addClass(String)", function() {
@ -949,7 +966,7 @@ test("toggleClass(Function[, boolean])", function() {
test("toggleClass(Fucntion[, boolean]) with incoming value", function() {
expect(14);
var e = jQuery("#firstp"), old = e.attr("class");
var e = jQuery("#firstp"), old = e.attr("class") || "";
ok( !e.is(".test"), "Assert class not present" );
e.toggleClass(function(i, val) {

View File

@ -475,3 +475,13 @@ test("widows & orphans #8936", function () {
$p.remove();
});
test("Do not append px to 'fill-opacity' #9548", 1, function() {
var $div = jQuery("<div>").appendTo("#qunit-fixture");
$div.css("fill-opacity", 0).animate({ "fill-opacity": 1.0 }, 0, function () {
equal( jQuery(this).css("fill-opacity"), 1, "Do not append px to 'fill-opacity'");
});
});

View File

@ -508,3 +508,20 @@ test("jQuery.data should follow html5 specification regarding camel casing", fun
div.remove();
});
test("jQuery.data should not miss data with preset hyphenated property names", function() {
expect(2);
var div = jQuery("<div/>", { id: "hyphened" }).appendTo("#qunit-fixture"),
test = {
"camelBar": "camelBar",
"hyphen-foo": "hyphen-foo"
};
div.data( test );
jQuery.each( test , function(i, k) {
equal( div.data(k), k, "data with property '"+k+"' was correctly found");
});
});

View File

@ -275,6 +275,33 @@ test( "jQuery.Deferred.pipe - deferred (fail)", function() {
strictEqual( value3, 6, "result of filter ok" );
});
test( "jQuery.Deferred.pipe - context", function() {
expect(4);
var context = {};
jQuery.Deferred().resolveWith( context, [ 2 ] ).pipe(function( value ) {
return value * 3;
}).done(function( value ) {
strictEqual( this, context, "custom context correctly propagated" );
strictEqual( value, 6, "proper value received" );
});
var defer = jQuery.Deferred(),
piped = defer.pipe(function( value ) {
return value * 3;
});
defer.resolve( 2 );
piped.done(function( value ) {
strictEqual( this.promise(), piped, "default context gets updated to latest defer in the chain" );
strictEqual( value, 6, "proper value received" );
});
});
test( "jQuery.when" , function() {
expect( 23 );

View File

@ -211,6 +211,31 @@ test("outerWidth()", function() {
jQuery.removeData($div[0], "olddisplay", true);
});
test("child of a hidden elem has accurate inner/outer/Width()/Height() see #9441 #9300", function() {
expect(8);
// setup html
var $divNormal = jQuery("<div>").css({ width: "100px", height: "100px", border: "10px solid white", padding: "2px", margin: "3px" }),
$divChild = $divNormal.clone(),
$divHiddenParent = jQuery("<div>").css( "display", "none" ).append( $divChild ).appendTo("body");
$divNormal.appendTo("body");
// tests that child div of a hidden div works the same as a normal div
equals( $divChild.width(), $divNormal.width(), "child of a hidden element width() is wrong see #9441" );
equals( $divChild.innerWidth(), $divNormal.innerWidth(), "child of a hidden element innerWidth() is wrong see #9441" );
equals( $divChild.outerWidth(), $divNormal.outerWidth(), "child of a hidden element outerWidth() is wrong see #9441" );
equals( $divChild.outerWidth(true), $divNormal.outerWidth( true ), "child of a hidden element outerWidth( true ) is wrong see #9300" );
equals( $divChild.height(), $divNormal.height(), "child of a hidden element height() is wrong see #9441" );
equals( $divChild.innerHeight(), $divNormal.innerHeight(), "child of a hidden element innerHeight() is wrong see #9441" );
equals( $divChild.outerHeight(), $divNormal.outerHeight(), "child of a hidden element outerHeight() is wrong see #9441" );
equals( $divChild.outerHeight(true), $divNormal.outerHeight( true ), "child of a hidden element outerHeight( true ) is wrong see #9300" );
// teardown html
$divHiddenParent.remove();
$divNormal.remove();
});
test("outerHeight()", function() {
expect(11);

View File

@ -780,6 +780,43 @@ test("mouseover triggers mouseenter", function() {
elem.remove();
});
test("withinElement implemented with jQuery.contains()", function() {
expect(1);
jQuery("#qunit-fixture").append('<div id="jc-outer"><div id="jc-inner"></div></div>');
jQuery("#jc-outer").bind("mouseenter mouseleave", function( event ) {
equal( this.id, "jc-outer", this.id + " " + event.type );
}).trigger("mouseenter");
jQuery("#jc-inner").trigger("mousenter");
jQuery("#jc-outer").unbind("mouseenter mouseleave").remove();
jQuery("#jc-inner").remove();
});
test("mouseenter, mouseleave don't catch exceptions", function() {
expect(2);
var elem = jQuery("#firstp").hover(function() { throw "an Exception"; });
try {
elem.mouseenter();
} catch (e) {
equals( e, "an Exception", "mouseenter doesn't catch exceptions" );
}
try {
elem.mouseleave();
} catch (e) {
equals( e, "an Exception", "mouseleave doesn't catch exceptions" );
}
});
test("trigger() shortcuts", function() {
expect(6);

View File

@ -1 +1 @@
1.6.2pre
1.6.3pre