Compare commits
60 Commits
Author | SHA1 | Date |
---|---|---|
Denis Knauf | bb7d98f018 | |
jaubourg | e6f8951983 | |
jaubourg | e83fcdcb02 | |
jaubourg | 139135a98a | |
jaubourg | 5b92a5f5ec | |
John Resig | e2ab2ba1d5 | |
John Resig | aa6f8c8cd3 | |
timmywil | ab1504f14f | |
timmywil | 96501d38a9 | |
Mike Sherov | 124817e668 | |
John Resig | d59b0f3e27 | |
John Resig | d269e426e0 | |
John Resig | 138d5b7b81 | |
John Resig | d443e533aa | |
Schalk Neethling | 8a532d1575 | |
rwldrn | 5eef5917fd | |
Greg Hazel | 13ceb0f56b | |
rwldrn | 6926247bf4 | |
timmywil | 641ad80211 | |
timmywil | 39a2f29c29 | |
timmywil | db437be6e3 | |
timmywil | 0a80be67f4 | |
timmywil | d66c3b6d84 | |
rwldrn | 6490c10c75 | |
timmywil | 75203de743 | |
Mike Sherov | 80ad14bd14 | |
rwldrn | 0742056645 | |
rwldrn | c3c001cf5b | |
timmywil | 71d2e657d0 | |
timmywil | 1d202c6afc | |
timmywil | 9d4033d629 | |
timmywil | bdce86dc2e | |
timmywil | edb2286544 | |
timmywil | 1d1cb582c0 | |
Scott Hughes | 287156197f | |
rwldrn | 408c98fb4b | |
timmywil | b8fc9d14a1 | |
timmywil | 657b197c19 | |
timmywil | a5396bde70 | |
timmywil | e5457a5a1f | |
Mathias Bynens | b43910a496 | |
rwldrn | f82b9dddc4 | |
timmywil | a1545b5079 | |
timmywil | 25118e22a2 | |
timmywil | ba90af0dc5 | |
timmywil | 7d3ba9f89e | |
Rick Waldron | c17f589ec9 | |
timmywil | a5cf257a8a | |
timmywil | 6171e0a923 | |
timmywil | cf702496ee | |
timmywil | bc82ff0ff9 | |
timmywil | 6f676e692d | |
Rick Waldron | ec829431fe | |
timmywil | a5b7c0fa33 | |
avaly | cbbd7d28e1 | |
timmywil | 3486365062 | |
jaubourg | 0f81cf8991 | |
jaubourg | ceba855c01 | |
John Resig | b60c8560ce | |
Rick Waldron | 0c2d1aee54 |
|
@ -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: []
|
||||
};
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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({
|
||||
|
@ -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 );
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -165,7 +166,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;
|
||||
|
@ -311,20 +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 ) &&
|
||||
(typeof value === "boolean" || value === undefined || value.toLowerCase() === name.toLowerCase()) ) {
|
||||
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 && (jQuery.nodeName( elem, "form" ) || rinvalidChar.test( name )) ) {
|
||||
hooks = formHook;
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -342,8 +352,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 {
|
||||
|
||||
|
@ -407,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;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -436,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 ) {
|
||||
|
@ -466,7 +496,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;
|
||||
},
|
||||
|
@ -481,7 +511,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() );
|
||||
|
@ -490,24 +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 elem.value;
|
||||
},
|
||||
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 ) {
|
||||
|
||||
|
@ -515,7 +527,7 @@ if ( !jQuery.support.getSetAttribute ) {
|
|||
jQuery.attrFix = jQuery.propFix;
|
||||
|
||||
// Use this for any attribute on a form in IE6/7
|
||||
formHook = jQuery.attrHooks.name = jQuery.valHooks.button = {
|
||||
formHook = jQuery.attrHooks.name = jQuery.attrHooks.title = jQuery.valHooks.button = {
|
||||
get: function( elem, name ) {
|
||||
var ret;
|
||||
ret = elem.getAttributeNode( name );
|
||||
|
|
17
src/core.js
17
src/core.js
|
@ -44,6 +44,14 @@ var jQuery = function( selector, context ) {
|
|||
rmsie = /(msie) ([\w.]+)/,
|
||||
rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
|
||||
|
||||
// Matches dashed string for camelizing
|
||||
rdashAlpha = /-([a-z])/ig,
|
||||
|
||||
// Used by jQuery.camelCase as callback to replace()
|
||||
fcamelCase = function( all, letter ) {
|
||||
return letter.toUpperCase();
|
||||
},
|
||||
|
||||
// Keep a UserAgent string for use with jQuery.browser
|
||||
userAgent = navigator.userAgent,
|
||||
|
||||
|
@ -582,6 +590,12 @@ jQuery.extend({
|
|||
}
|
||||
},
|
||||
|
||||
// Converts a dashed string to camelCased string;
|
||||
// Used by both the css and data modules
|
||||
camelCase: function( string ) {
|
||||
return string.replace( rdashAlpha, fcamelCase );
|
||||
},
|
||||
|
||||
nodeName: function( elem, name ) {
|
||||
return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
|
||||
},
|
||||
|
@ -778,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;
|
||||
|
||||
|
@ -909,7 +923,6 @@ function doScrollCheck() {
|
|||
jQuery.ready();
|
||||
}
|
||||
|
||||
// Expose jQuery to the global object
|
||||
return jQuery;
|
||||
|
||||
})();
|
||||
|
|
106
src/css.js
106
src/css.js
|
@ -2,7 +2,6 @@
|
|||
|
||||
var ralpha = /alpha\([^)]*\)/i,
|
||||
ropacity = /opacity=([^)]*)/,
|
||||
rdashAlpha = /-([a-z])/ig,
|
||||
// fixed for IE9, see #8346
|
||||
rupper = /([A-Z]|^ms)/g,
|
||||
rnumpx = /^-?\d+(?:px)?$/i,
|
||||
|
@ -16,11 +15,7 @@ var ralpha = /alpha\([^)]*\)/i,
|
|||
curCSS,
|
||||
|
||||
getComputedStyle,
|
||||
currentStyle,
|
||||
|
||||
fcamelCase = function( all, letter ) {
|
||||
return letter.toUpperCase();
|
||||
};
|
||||
currentStyle;
|
||||
|
||||
jQuery.fn.css = function( name, value ) {
|
||||
// Setting 'undefined' is a no-op
|
||||
|
@ -55,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
|
||||
|
@ -96,6 +92,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)
|
||||
|
@ -162,10 +160,6 @@ jQuery.extend({
|
|||
for ( name in options ) {
|
||||
elem.style[ name ] = old[ name ];
|
||||
}
|
||||
},
|
||||
|
||||
camelCase: function( string ) {
|
||||
return string.replace( rdashAlpha, fcamelCase );
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -179,44 +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";
|
||||
|
@ -339,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 ) {
|
||||
|
|
|
@ -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 */ ) {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -1,21 +1,23 @@
|
|||
(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() {
|
||||
return this[0] ?
|
||||
parseFloat( jQuery.css( this[0], type, "padding" ) ) :
|
||||
jQuery.fn[ "inner" + name ] = function() {
|
||||
var elem = this[0];
|
||||
return elem && elem.style ?
|
||||
parseFloat( jQuery.css( elem, type, "padding" ) ) :
|
||||
null;
|
||||
};
|
||||
|
||||
// outerHeight and outerWidth
|
||||
jQuery.fn["outer" + name] = function( margin ) {
|
||||
return this[0] ?
|
||||
parseFloat( jQuery.css( this[0], type, margin ? "margin" : "border" ) ) :
|
||||
jQuery.fn[ "outer" + name ] = function( margin ) {
|
||||
var elem = this[0];
|
||||
return elem && elem.style ?
|
||||
parseFloat( jQuery.css( elem, type, margin ? "margin" : "border" ) ) :
|
||||
null;
|
||||
};
|
||||
|
||||
|
|
|
@ -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 ) {
|
||||
|
@ -330,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;
|
||||
|
@ -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 ) {
|
||||
|
@ -574,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();
|
||||
|
@ -588,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 );
|
||||
|
@ -604,7 +606,7 @@ function defaultDisplay( nodeName ) {
|
|||
|
||||
display = jQuery.css( elem, "display" );
|
||||
|
||||
document.body.removeChild( iframe );
|
||||
body.removeChild( iframe );
|
||||
}
|
||||
|
||||
// Store the correct default display
|
||||
|
|
36
src/event.js
36
src/event.js
|
@ -1,7 +1,6 @@
|
|||
(function( jQuery ) {
|
||||
|
||||
var hasOwn = Object.prototype.hasOwnProperty,
|
||||
rnamespaces = /\.(.*)$/,
|
||||
var rnamespaces = /\.(.*)$/,
|
||||
rformElems = /^(?:textarea|input|select)$/i,
|
||||
rperiod = /\./g,
|
||||
rspaces = / /g,
|
||||
|
@ -345,7 +344,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,
|
||||
|
@ -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,
|
||||
|
|
|
@ -438,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
|
||||
|
@ -520,7 +533,7 @@ function fixDefaultChecked( elem ) {
|
|||
function findInputs( elem ) {
|
||||
if ( jQuery.nodeName( elem, "input" ) ) {
|
||||
fixDefaultChecked( elem );
|
||||
} else if ( elem.getElementsByTagName ) {
|
||||
} else if ( "getElementsByTagName" in elem ) {
|
||||
jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked );
|
||||
}
|
||||
}
|
||||
|
@ -569,6 +582,8 @@ jQuery.extend({
|
|||
}
|
||||
}
|
||||
|
||||
srcElements = destElements = null;
|
||||
|
||||
// Return the cloned set
|
||||
return clone;
|
||||
},
|
||||
|
@ -747,4 +762,4 @@ function evalScript( i, elem ) {
|
|||
}
|
||||
}
|
||||
|
||||
})( jQuery );
|
||||
})( jQuery );
|
|
@ -1,2 +1,3 @@
|
|||
// Expose jQuery to the global object
|
||||
window.jQuery = window.$ = jQuery;
|
||||
})(window);
|
||||
|
|
|
@ -13,7 +13,9 @@ jQuery.support = (function() {
|
|||
support,
|
||||
fragment,
|
||||
body,
|
||||
bodyStyle,
|
||||
testElementParent,
|
||||
testElement,
|
||||
testElementStyle,
|
||||
tds,
|
||||
events,
|
||||
eventName,
|
||||
|
@ -107,11 +109,10 @@ jQuery.support = (function() {
|
|||
}
|
||||
|
||||
if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
|
||||
div.attachEvent( "onclick", function click() {
|
||||
div.attachEvent( "onclick", function() {
|
||||
// Cloning a node shouldn't copy over any
|
||||
// bound event handlers (IE does this)
|
||||
support.noCloneEvent = false;
|
||||
div.detachEvent( "onclick", click );
|
||||
});
|
||||
div.cloneNode( true ).fireEvent( "onclick" );
|
||||
}
|
||||
|
@ -136,22 +137,30 @@ 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,
|
||||
border: 0,
|
||||
margin: 0,
|
||||
// Set background to avoid IE crashes when removing (#9028)
|
||||
background: "none"
|
||||
margin: 0
|
||||
};
|
||||
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)
|
||||
|
@ -210,8 +219,8 @@ jQuery.support = (function() {
|
|||
}
|
||||
|
||||
// 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/
|
||||
|
@ -235,6 +244,9 @@ jQuery.support = (function() {
|
|||
}
|
||||
}
|
||||
|
||||
// Null connected elements to avoid leaks in IE
|
||||
testElement = fragment = select = opt = body = marginDiv = div = input = null;
|
||||
|
||||
return support;
|
||||
})();
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
|
@ -117,3 +117,7 @@ v\:oval { behavior:url(#default#VML); display:inline-block; }
|
|||
tt { display: none; }
|
||||
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://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif) no-repeat -1000px 0; }
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit d97b37ec322136406790e75d03333559f38bbecb
|
||||
Subproject commit d4f23f8a882d13b71768503e2db9fa33ef169ba0
|
|
@ -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() {
|
||||
|
|
|
@ -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,6 +54,7 @@ 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" );
|
||||
|
||||
|
@ -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,28 @@ 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);
|
||||
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();
|
||||
});
|
||||
});
|
||||
|
@ -144,7 +162,7 @@ test("attr(Hash)", function() {
|
|||
});
|
||||
|
||||
test("attr(String, Object)", function() {
|
||||
expect(66);
|
||||
expect(69);
|
||||
|
||||
var div = jQuery("div").attr("foo", "bar"),
|
||||
fail = false;
|
||||
|
@ -193,6 +211,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" );
|
||||
|
@ -589,6 +612,30 @@ test("val()", function() {
|
|||
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);
|
||||
|
||||
|
@ -715,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" );
|
||||
|
||||
|
@ -741,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() {
|
||||
|
@ -903,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) {
|
||||
|
|
|
@ -1104,3 +1104,17 @@ test("jQuery.sub() - .fn Methods", function(){
|
|||
});
|
||||
|
||||
});
|
||||
|
||||
test("jQuery.camelCase()", function() {
|
||||
|
||||
var tests = {
|
||||
"foo-bar": "fooBar",
|
||||
"foo-bar-baz": "fooBarBaz"
|
||||
};
|
||||
|
||||
expect(2);
|
||||
|
||||
jQuery.each( tests, function( key, val ) {
|
||||
equal( jQuery.camelCase( key ), val, "Converts: " + key + " => " + val );
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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() {
|
||||
|
@ -425,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'");
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -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");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -107,7 +107,13 @@ test("height() with function args", function() {
|
|||
});
|
||||
|
||||
test("innerWidth()", function() {
|
||||
expect(4);
|
||||
expect(8);
|
||||
|
||||
equals(jQuery(window).innerWidth(), null, "Test on window without margin option");
|
||||
equals(jQuery(window).innerWidth(true), null, "Test on window with margin option");
|
||||
|
||||
equals(jQuery(document).innerWidth(), null, "Test on document without margin option");
|
||||
equals(jQuery(document).innerWidth(true), null, "Test on document with margin option");
|
||||
|
||||
var $div = jQuery("#nothiddendiv");
|
||||
// set styles
|
||||
|
@ -136,7 +142,13 @@ test("innerWidth()", function() {
|
|||
});
|
||||
|
||||
test("innerHeight()", function() {
|
||||
expect(4);
|
||||
expect(8);
|
||||
|
||||
equals(jQuery(window).innerHeight(), null, "Test on window without margin option");
|
||||
equals(jQuery(window).innerHeight(true), null, "Test on window with margin option");
|
||||
|
||||
equals(jQuery(document).innerHeight(), null, "Test on document without margin option");
|
||||
equals(jQuery(document).innerHeight(true), null, "Test on document with margin option");
|
||||
|
||||
var $div = jQuery("#nothiddendiv");
|
||||
// set styles
|
||||
|
@ -165,7 +177,12 @@ test("innerHeight()", function() {
|
|||
});
|
||||
|
||||
test("outerWidth()", function() {
|
||||
expect(7);
|
||||
expect(11);
|
||||
|
||||
equal( jQuery( window ).outerWidth(), null, "Test on window without margin option" );
|
||||
equal( jQuery( window ).outerWidth( true ), null, "Test on window with margin option" );
|
||||
equal( jQuery( document ).outerWidth(), null, "Test on document without margin option" );
|
||||
equal( jQuery( document ).outerWidth( true ), null, "Test on document with margin option" );
|
||||
|
||||
var $div = jQuery("#nothiddendiv");
|
||||
$div.css("width", 30);
|
||||
|
@ -194,8 +211,38 @@ 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(7);
|
||||
expect(11);
|
||||
|
||||
equal( jQuery( window ).outerHeight(), null, "Test on window without margin option" );
|
||||
equal( jQuery( window ).outerHeight( true ), null, "Test on window with margin option" );
|
||||
equal( jQuery( document ).outerHeight(), null, "Test on document without margin option" );
|
||||
equal( jQuery( document ).outerHeight( true ), null, "Test on document with margin option" );
|
||||
|
||||
var $div = jQuery("#nothiddendiv");
|
||||
$div.css("height", 30);
|
||||
|
|
|
@ -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) {
|
||||
|
@ -760,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);
|
||||
|
||||
|
|
|
@ -465,6 +465,40 @@ test("append the same fragment with events (Bug #6997, 5566)", function () {
|
|||
jQuery("#listWithTabIndex li.test6997").eq(1).click();
|
||||
});
|
||||
|
||||
test("append(xml)", function() {
|
||||
expect( 1 );
|
||||
|
||||
function createXMLDoc() {
|
||||
// Initialize DOM based upon latest installed MSXML or Netscape
|
||||
var elem,
|
||||
aActiveX =
|
||||
[ "MSXML6.DomDocument",
|
||||
"MSXML3.DomDocument",
|
||||
"MSXML2.DomDocument",
|
||||
"MSXML.DomDocument",
|
||||
"Microsoft.XmlDom" ];
|
||||
|
||||
if ( document.implementation && "createDocument" in document.implementation ) {
|
||||
return document.implementation.createDocument( "", "", null );
|
||||
} else {
|
||||
// IE
|
||||
for ( var n = 0, len = aActiveX.length; n < len; n++ ) {
|
||||
try {
|
||||
elem = new ActiveXObject( aActiveX[ n ] );
|
||||
return elem;
|
||||
} catch(_){};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var xmlDoc = createXMLDoc(),
|
||||
xml1 = xmlDoc.createElement("head"),
|
||||
xml2 = xmlDoc.createElement("test");
|
||||
|
||||
ok( jQuery( xml1 ).append( xml2 ), "Append an xml element to another without raising an exception." );
|
||||
|
||||
});
|
||||
|
||||
test("appendTo(String|Element|Array<Element>|jQuery)", function() {
|
||||
expect(16);
|
||||
|
||||
|
@ -1393,7 +1427,7 @@ 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();
|
||||
});
|
||||
|
||||
|
@ -1421,3 +1455,13 @@ test( "jQuery.html - execute scripts escaped with html comment or CDATA (#9221)"
|
|||
'</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() {
|
||||
|
|
|
@ -30,3 +30,26 @@ function supportIFrameTest( title, url, noDisplay, func ) {
|
|||
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.1
|
||||
1.6.3pre
|
Loading…
Reference in New Issue