diff --git a/Makefile b/Makefile index 06cee5de..4a0a80ba 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,8 @@ COMPILER = ${JS_ENGINE} ${BUILD_DIR}/uglify.js --unsafe POST_COMPILER = ${JS_ENGINE} ${BUILD_DIR}/post-compile.js BASE_FILES = ${SRC_DIR}/core.js\ + ${SRC_DIR}/callbacks.js\ + ${SRC_DIR}/topic.js\ ${SRC_DIR}/deferred.js\ ${SRC_DIR}/support.js\ ${SRC_DIR}/data.js\ diff --git a/build/release-notes.js b/build/release-notes.js index b112d998..0166732e 100644 --- a/build/release-notes.js +++ b/build/release-notes.js @@ -9,9 +9,9 @@ var fs = require("fs"), extract = /(.*?)<[^"]+"component">\s*(\S+)/g; var opts = { - version: "1.6.2 RC 1", - short_version: "1.6.2rc1", - final_version: "1.6.2", + version: "1.6.1 RC 1", + short_version: "1.6rc1", + final_version: "1.6.1", categories: [] }; diff --git a/src/ajax.js b/src/ajax.js index 355fd7e4..b9be5eb1 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -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|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i, + rinput = /^(?:color|date|datetime|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|res|widget):$/, + rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|widget):$/, rnoContent = /^(?:GET|HEAD)$/, rprotocol = /^\/\//, rquery = /\?/, @@ -382,7 +382,7 @@ jQuery.extend({ jQuery( callbackContext ) : jQuery.event, // Deferreds deferred = jQuery.Deferred(), - completeDeferred = jQuery._Deferred(), + completeCallbacks = jQuery.Callbacks( "once memory" ), // Status-dependent callbacks statusCode = s.statusCode || {}, // ifModified key @@ -560,7 +560,7 @@ jQuery.extend({ } // Complete - completeDeferred.resolveWith( callbackContext, [ jqXHR, statusText ] ); + completeCallbacks.fireWith( callbackContext, [ jqXHR, statusText ] ); if ( fireGlobals ) { globalEventContext.trigger( "ajaxComplete", [ jqXHR, s] ); @@ -575,7 +575,7 @@ jQuery.extend({ deferred.promise( jqXHR ); jqXHR.success = jqXHR.done; jqXHR.error = jqXHR.fail; - jqXHR.complete = completeDeferred.done; + jqXHR.complete = completeCallbacks.add; // Status-dependent callbacks jqXHR.statusCode = function( map ) { @@ -644,8 +644,6 @@ 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 @@ -729,7 +727,7 @@ jQuery.extend({ transport.send( requestHeaders, done ); } catch (e) { // Propagate exception as error if not done - if ( state < 2 ) { + if ( status < 2 ) { done( -1, e ); // Simply rethrow otherwise } else { diff --git a/src/attributes.js b/src/attributes.js index 1e0e79f4..9b8c4bf0 100644 --- a/src/attributes.js +++ b/src/attributes.js @@ -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() { @@ -37,31 +37,30 @@ jQuery.fn.extend({ }, addClass: function( value ) { - var classNames, i, l, elem, - setClass, c, cl; - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).addClass( value.call(this, j, this.className) ); + return this.each(function(i) { + var self = jQuery(this); + self.addClass( value.call(this, i, self.attr("class") || "") ); }); } if ( value && typeof value === "string" ) { - classNames = value.split( rspace ); + var classNames = (value || "").split( rspace ); - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; + for ( var i = 0, l = this.length; i < l; i++ ) { + var elem = this[i]; if ( elem.nodeType === 1 ) { - if ( !elem.className && classNames.length === 1 ) { + if ( !elem.className ) { elem.className = value; } else { - setClass = " " + elem.className + " "; + var className = " " + elem.className + " ", + setClass = elem.className; - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) { - setClass += classNames[ c ] + " "; + for ( var c = 0, cl = classNames.length; c < cl; c++ ) { + if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) { + setClass += " " + classNames[c]; } } elem.className = jQuery.trim( setClass ); @@ -74,25 +73,24 @@ jQuery.fn.extend({ }, removeClass: function( value ) { - 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 ( jQuery.isFunction(value) ) { + return this.each(function(i) { + var self = jQuery(this); + self.removeClass( value.call(this, i, self.attr("class")) ); }); } if ( (value && typeof value === "string") || value === undefined ) { - classNames = (value || "").split( rspace ); + var classNames = (value || "").split( rspace ); - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; + for ( var i = 0, l = this.length; i < l; i++ ) { + var elem = this[i]; if ( elem.nodeType === 1 && elem.className ) { if ( value ) { - className = (" " + elem.className + " ").replace( rclass, " " ); - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - className = className.replace(" " + classNames[ c ] + " ", " "); + var className = (" " + elem.className + " ").replace(rclass, " "); + for ( var c = 0, cl = classNames.length; c < cl; c++ ) { + className = className.replace(" " + classNames[c] + " ", " "); } elem.className = jQuery.trim( className ); @@ -111,8 +109,9 @@ jQuery.fn.extend({ isBool = typeof stateVal === "boolean"; if ( jQuery.isFunction( value ) ) { - return this.each(function( i ) { - jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); + return this.each(function(i) { + var self = jQuery(this); + self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal ); }); } @@ -157,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 ]; @@ -168,9 +167,9 @@ jQuery.fn.extend({ ret = elem.value; - return typeof ret === "string" ? + return typeof ret === "string" ? // handle most common string cases - ret.replace(rreturn, "") : + ret.replace(rreturn, "") : // handle cases where value is null/undef or number ret == null ? "" : ret; } @@ -291,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; @@ -318,23 +317,21 @@ jQuery.extend({ notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); // Normalize the name if needed - if ( notxml ) { - name = jQuery.attrFix[ name ] || name; + name = notxml && 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; } } @@ -370,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 ); @@ -417,25 +414,6 @@ 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; - } } }, @@ -453,7 +431,7 @@ jQuery.extend({ frameborder: "frameBorder", contenteditable: "contentEditable" }, - + prop: function( elem, name, value ) { var nType = elem.nodeType; @@ -465,11 +443,10 @@ jQuery.extend({ var ret, hooks, notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - if ( notxml ) { - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } + // 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 ) { @@ -488,7 +465,7 @@ jQuery.extend({ } } }, - + propHooks: {} }); @@ -520,12 +497,32 @@ 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.title = jQuery.valHooks.button = { get: function( elem, name ) { diff --git a/src/callbacks.js b/src/callbacks.js new file mode 100644 index 00000000..a1caf91f --- /dev/null +++ b/src/callbacks.js @@ -0,0 +1,257 @@ +(function( jQuery ) { + +// String to Object flags format cache +var flagsCache = {}; + +// Convert String-formatted flags into Object-formatted ones and store in cache +function createFlags( flags ) { + var object = flagsCache[ flags ] = {}, + i, length; + flags = flags.split( /\s+/ ); + for ( i = 0, length = flags.length; i < length; i++ ) { + object[ flags[i] ] = true; + } + return object; +} + +/* + * Create a callback list using the following parameters: + * + * flags: an optional list of space-separated flags that will change how + * the callback list behaves + * + * filter: an optional function that will be applied to each added callbacks, + * what filter returns will then be added provided it is not falsy. + * + * By default a callback list will act like an event callback list and can be + * "fired" multiple times. + * + * Possible flags: + * + * once: will ensure the callback list can only be fired once (like a Deferred) + * + * memory: will keep track of previous values and will call any callback added + * after the list has been fired right away with the latest "memorized" + * values (like a Deferred) + * + * queue: only first callback in the list is called each time the list is fired + * (cannot be used in conjunction with memory) + * + * unique: will ensure a callback can only be added once (no duplicate in the list) + * + * relocate: like "unique" but will relocate the callback at the end of the list + * + * stopOnFalse: interrupt callings when a callback returns false + * + * addAfterFire: if callbacks are added while firing, then they are not executed until after + * the next call to fire/fireWith + * + */ +jQuery.Callbacks = function( flags, filter ) { + + // flags are optional + if ( typeof flags !== "string" ) { + filter = flags; + flags = undefined; + } + + // Convert flags from String-formatted to Object-formatted + // (we check in cache first) + flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {}; + + var // Actual callback list + list = [], + // Stack of fire calls for repeatable lists + stack = [], + // Last fire value (for non-forgettable lists) + memory, + // Flag to know if list is currently firing + firing, + // First callback to fire (used internally by add and fireWith) + firingStart, + // End of the loop when firing + firingLength, + // Index of currently firing callback (modified by remove if needed) + firingIndex, + // Add one or several callbacks to the list + add = function( args ) { + var i, + length, + elem, + type, + actual; + for ( i = 0, length = args.length; i < length; i++ ) { + elem = args[ i ]; + type = jQuery.type( elem ); + if ( type === "array" ) { + // Inspect recursively + add( elem ); + } else if ( type === "function" ) { + // If we have to relocate, we remove the callback + // if it already exists + if ( flags.relocate ) { + self.remove( elem ); + // Skip if we're in unique mode and callback is already in + } else if ( flags.unique && self.has( elem ) ) { + continue; + } + // Get the filtered function if needs be + actual = filter ? filter( elem ) : elem; + if ( actual ) { + list.push( [ elem, actual ] ); + } + } + } + }, + // Fire callbacks + fire = function( context, args ) { + args = args || []; + memory = !flags.memory || [ context, args ]; + firing = true; + firingIndex = firingStart || 0; + firingStart = 0; + firingLength = list.length; + for ( ; list && firingIndex < firingLength; firingIndex++ ) { + if ( list[ firingIndex ][ 1 ].apply( context, args ) === false && flags.stopOnFalse ) { + memory = true; // Mark as halted + break; + } else if ( flags.queue ) { + list.splice( firingIndex, 1 ); + break; + } + } + firing = false; + if ( list ) { + if ( !flags.once ) { + if ( stack && stack.length ) { + memory = stack.shift(); + self.fireWith( memory[ 0 ], memory[ 1 ] ); + } + } else if ( memory === true ) { + self.disable(); + } else { + list = []; + } + } + }, + // Actual Callbacks object + self = { + // Add a callback or a collection of callbacks to the list + add: function() { + if ( list ) { + var length = list.length; + add( arguments ); + // Do we need to add the callbacks to the + // current firing batch? + if ( firing ) { + if ( !flags.addAfterFire ) { + firingLength = list.length; + } + // With memory, if we're not firing then + // we should call right away, unless previous + // firing was halted (stopOnFalse) + } else if ( memory && memory !== true ) { + firingStart = length; + fire( memory[ 0 ], memory[ 1 ] ); + } + } + return this; + }, + // Remove a callback from the list + remove: function() { + if ( list ) { + var args = arguments, + argIndex = 0, + argLength = args.length; + for ( ; argIndex < argLength ; argIndex++ ) { + for ( var i = 0; i < list.length; i++ ) { + if ( args[ argIndex ] === list[ i ][ 0 ] ) { + // Handle firingIndex and firingLength + if ( firing ) { + if ( i <= firingLength ) { + firingLength--; + if ( i <= firingIndex ) { + firingIndex--; + } + } + } + // Remove the element + list.splice( i--, 1 ); + // If we have some unicity property then + // we only need to do this once + if ( flags.unique || flags.relocate ) { + break; + } + } + } + } + } + return this; + }, + // Control if a given callback is in the list + has: function( fn ) { + if ( list ) { + var i = 0, + length = list.length; + for ( ; i < length; i++ ) { + if ( fn === list[ i ][ 0 ] ) { + return true; + } + } + } + return false; + }, + // Remove all callbacks from the list + empty: function() { + list = []; + return this; + }, + // Have the list do nothing anymore + disable: function() { + list = stack = memory = undefined; + return this; + }, + // Is it disabled? + disabled: function() { + return !list; + }, + // Lock the list in its current state + lock: function() { + stack = undefined; + if ( !memory || memory === true ) { + self.disable(); + } + return this; + }, + // Is it locked? + locked: function() { + return !stack; + }, + // Call all callbacks with the given context and arguments + fireWith: function( context, args ) { + if ( stack ) { + if ( firing ) { + if ( !flags.once ) { + stack.push( [ context, args ] ); + } + } else if ( !( flags.once && memory ) ) { + fire( context, args ); + } + } + return this; + }, + // Call all the callbacks with the given arguments + fire: function() { + self.fireWith( this, arguments ); + return this; + }, + // To know if the callbacks have already been called at least once + fired: function() { + return !!memory; + } + }; + + return self; +}; + +})( jQuery ); diff --git a/src/core.js b/src/core.js index ab0d9f7b..f68675ce 100644 --- a/src/core.js +++ b/src/core.js @@ -58,7 +58,7 @@ var jQuery = function( selector, context ) { // For matching the engine and version of the browser browserMatch, - // The deferred used on DOM ready + // The callback list used on DOM ready readyList, // The ready event handler @@ -257,7 +257,7 @@ jQuery.fn = jQuery.prototype = { jQuery.bindReady(); // Add the callback - readyList.done( fn ); + readyList.add( fn ); return this; }, @@ -412,7 +412,7 @@ jQuery.extend({ } // If there are functions bound, to execute - readyList.resolveWith( document, [ jQuery ] ); + readyList.fireWith( document, [ jQuery ] ); // Trigger any bound ready events if ( jQuery.fn.trigger ) { @@ -426,7 +426,7 @@ jQuery.extend({ return; } - readyList = jQuery._Deferred(); + readyList = jQuery.Callbacks( "once memory" ); // Catch cases where $(document).ready() is called after the // browser event has already occurred. @@ -792,7 +792,7 @@ jQuery.extend({ }, // Mutifunctional method to get and set values to a collection - // The value/s can optionally be executed if it's a function + // The value/s can be optionally by executed if its a function access: function( elems, key, value, exec, fn, pass ) { var length = elems.length; @@ -923,6 +923,7 @@ function doScrollCheck() { jQuery.ready(); } +// Expose jQuery to the global object return jQuery; })(); diff --git a/src/css.js b/src/css.js index cb7df9f8..e3ab270f 100644 --- a/src/css.js +++ b/src/css.js @@ -50,14 +50,13 @@ jQuery.extend({ // Exclude the following css properties to add px cssNumber: { - "fillOpacity": true, - "fontWeight": true, - "lineHeight": true, - "opacity": true, - "orphans": true, - "widows": true, "zIndex": true, - "zoom": true + "fontWeight": true, + "opacity": true, + "zoom": true, + "lineHeight": true, + "widows": true, + "orphans": true }, // Add in properties whose names you wish to fix before @@ -173,21 +172,43 @@ jQuery.each(["height", "width"], function( i, name ) { if ( computed ) { if ( elem.offsetWidth !== 0 ) { - return getWH( elem, name, extra ); + val = getWH( elem, name, extra ); + } else { jQuery.swap( elem, cssShow, function() { val = getWH( elem, name, extra ); }); } - return val; + 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"; } }, 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"; @@ -310,50 +331,27 @@ 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; - // Start with offset property - var val = name === "width" ? elem.offsetWidth : elem.offsetHeight, - which = name === "width" ? cssWidth : cssHeight; + if ( extra === "border" ) { + return val; + } - 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; - } - }); + jQuery.each( which, function() { + if ( !extra ) { + val -= parseFloat(jQuery.css( elem, "padding" + this )) || 0; } - return val + "px"; - } + if ( extra === "margin" ) { + val += parseFloat(jQuery.css( elem, "margin" + 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; + } else { + val -= parseFloat(jQuery.css( elem, "border" + this + "Width" )) || 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; - } - }); - } - - return val + "px"; + return val; } if ( jQuery.expr && jQuery.expr.filters ) { diff --git a/src/data.js b/src/data.js index f69d9dec..c019a64e 100644 --- a/src/data.js +++ b/src/data.js @@ -108,10 +108,7 @@ jQuery.extend({ return thisCache[ internalKey ] && thisCache[ internalKey ].events; } - return getByName ? - // Check for both converted-to-camel and non-converted data property names - thisCache[ jQuery.camelCase( name ) ] || thisCache[ name ] : - thisCache; + return getByName ? thisCache[ jQuery.camelCase( name ) ] : thisCache; }, removeData: function( elem, name, pvt /* Internal Use Only */ ) { diff --git a/src/deferred.js b/src/deferred.js index e543f151..e527e938 100644 --- a/src/deferred.js +++ b/src/deferred.js @@ -1,187 +1,127 @@ (function( jQuery ) { var // Promise methods - promiseMethods = "done fail isResolved isRejected promise then always pipe".split( " " ), + promiseMethods = "done removeDone fail removeFail progress removeProgress isResolved isRejected promise then always pipe".split( " " ), // Static reference to slice sliceDeferred = [].slice; jQuery.extend({ - // Create a simple deferred (one callbacks list) - _Deferred: function() { - var // callbacks list - callbacks = [], - // stored [ context , args ] - fired, - // to avoid firing when already doing so - firing, - // flag to know if the deferred has been cancelled - cancelled, - // the deferred itself - deferred = { - // done( f1, f2, ...) - done: function() { - if ( !cancelled ) { - var args = arguments, - i, - length, - elem, - type, - _fired; - if ( fired ) { - _fired = fired; - fired = 0; - } - for ( i = 0, length = args.length; i < length; i++ ) { - elem = args[ i ]; - type = jQuery.type( elem ); - if ( type === "array" ) { - deferred.done.apply( deferred, elem ); - } else if ( type === "function" ) { - callbacks.push( elem ); + Deferred: function( func ) { + var doneList = jQuery.Callbacks( "once memory" ), + failList = jQuery.Callbacks( "once memory" ), + progressList = jQuery.Callbacks( "memory" ), + promise, + deferred = { + // Copy existing methods from lists + done: doneList.add, + removeDone: doneList.remove, + fail: failList.add, + removeFail: failList.remove, + progress: progressList.add, + removeProgress: progressList.remove, + resolve: doneList.fire, + resolveWith: doneList.fireWith, + reject: failList.fire, + rejectWith: failList.fireWith, + ping: progressList.fire, + pingWith: progressList.fireWith, + isResolved: doneList.fired, + isRejected: failList.fired, + + // Create Deferred-specific methods + then: function( doneCallbacks, failCallbacks, progressCallbacks ) { + deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks ); + return this; + }, + always: function() { + return deferred.done.apply( deferred, arguments ).fail.apply( this, arguments ); + }, + pipe: function( fnDone, fnFail, fnProgress ) { + return jQuery.Deferred(function( newDefer ) { + jQuery.each( { + done: [ fnDone, "resolve" ], + fail: [ fnFail, "reject" ], + progress: [ fnProgress, "ping" ] + }, function( handler, data ) { + var fn = data[ 0 ], + action = data[ 1 ], + returned; + if ( jQuery.isFunction( fn ) ) { + deferred[ handler ](function() { + returned = fn.apply( this, arguments ); + if ( returned && jQuery.isFunction( returned.promise ) ) { + returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.ping ); + } else { + newDefer[ action ]( returned ); + } + }); + } else { + deferred[ handler ]( newDefer[ action ] ); } + }); + }).promise(); + }, + // Get a promise for this deferred + // If obj is provided, the promise aspect is added to the object + promise: function( obj ) { + if ( obj == null ) { + if ( promise ) { + return promise; } - if ( _fired ) { - deferred.resolveWith( _fired[ 0 ], _fired[ 1 ] ); - } + promise = obj = {}; } - return this; - }, - - // resolve with given context and args - resolveWith: function( context, args ) { - if ( !cancelled && !fired && !firing ) { - // make sure args are available (#8421) - args = args || []; - firing = 1; - try { - while( callbacks[ 0 ] ) { - callbacks.shift().apply( context, args ); - } - } - finally { - fired = [ context, args ]; - firing = 0; - } + var i = promiseMethods.length; + while( i-- ) { + obj[ promiseMethods[i] ] = deferred[ promiseMethods[i] ]; } - return this; - }, - - // resolve with this as context and given arguments - resolve: function() { - deferred.resolveWith( this, arguments ); - return this; - }, - - // Has this deferred been resolved? - isResolved: function() { - return !!( firing || fired ); - }, - - // Cancel - cancel: function() { - cancelled = 1; - callbacks = []; - return this; + return obj; } }; - return deferred; - }, + // Handle lists exclusiveness + deferred.done( failList.disable, progressList.lock ) + .fail( doneList.disable, progressList.lock ); - // Full fledged deferred (two callbacks list) - Deferred: function( func ) { - var deferred = jQuery._Deferred(), - failDeferred = jQuery._Deferred(), - promise; - // Add errorDeferred methods, then and promise - jQuery.extend( deferred, { - then: function( doneCallbacks, failCallbacks ) { - deferred.done( doneCallbacks ).fail( failCallbacks ); - return this; - }, - always: function() { - return deferred.done.apply( deferred, arguments ).fail.apply( this, arguments ); - }, - fail: failDeferred.done, - rejectWith: failDeferred.resolveWith, - reject: failDeferred.resolve, - isRejected: failDeferred.isResolved, - pipe: function( fnDone, fnFail ) { - return jQuery.Deferred(function( newDefer ) { - jQuery.each( { - done: [ fnDone, "resolve" ], - fail: [ fnFail, "reject" ] - }, function( handler, data ) { - var fn = data[ 0 ], - action = data[ 1 ], - returned; - if ( jQuery.isFunction( fn ) ) { - deferred[ handler ](function() { - returned = fn.apply( this, arguments ); - if ( returned && jQuery.isFunction( returned.promise ) ) { - returned.promise().then( newDefer.resolve, newDefer.reject ); - } else { - newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); - } - }); - } else { - deferred[ handler ]( newDefer[ action ] ); - } - }); - }).promise(); - }, - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - if ( obj == null ) { - if ( promise ) { - return promise; - } - promise = obj = {}; - } - var i = promiseMethods.length; - while( i-- ) { - obj[ promiseMethods[i] ] = deferred[ promiseMethods[i] ]; - } - return obj; - } - }); - // Make sure only one callback list will be used - deferred.done( failDeferred.cancel ).fail( deferred.cancel ); - // Unexpose cancel - delete deferred.cancel; // Call given func if any if ( func ) { func.call( deferred, deferred ); } + + // All done! return deferred; }, // Deferred helper when: function( firstParam ) { - var args = arguments, + var args = sliceDeferred.call( arguments, 0 ), i = 0, length = args.length, + pValues = new Array( length ), count = length, + pCount = length, deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ? firstParam : - jQuery.Deferred(); + jQuery.Deferred(), + promise = deferred.promise(); function resolveFunc( i ) { return function( value ) { args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; if ( !( --count ) ) { - // Strange bug in FF4: - // Values changed onto the arguments object sometimes end up as undefined values - // outside the $.when method. Cloning the object into a fresh array solves the issue - deferred.resolveWith( deferred, sliceDeferred.call( args, 0 ) ); + deferred.resolveWith( deferred, args ); } }; } + function progressFunc( i ) { + return function( value ) { + pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; + deferred.pingWith( promise, pValues ); + }; + } if ( length > 1 ) { for( ; i < length; i++ ) { - if ( args[ i ] && jQuery.isFunction( args[ i ].promise ) ) { - args[ i ].promise().then( resolveFunc(i), deferred.reject ); + if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) { + args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) ); } else { --count; } @@ -192,7 +132,7 @@ jQuery.extend({ } else if ( deferred !== firstParam ) { deferred.resolveWith( deferred, length ? [ firstParam ] : [] ); } - return deferred.promise(); + return promise; } }); diff --git a/src/dimensions.js b/src/dimensions.js index 88fa1750..8559056b 100644 --- a/src/dimensions.js +++ b/src/dimensions.js @@ -1,12 +1,12 @@ (function( jQuery ) { -// Create width, height, innerHeight, innerWidth, outerHeight and outerWidth methods +// Create 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" ) ) : diff --git a/src/effects.js b/src/effects.js index a7529a0f..22496277 100644 --- a/src/effects.js +++ b/src/effects.js @@ -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 = true; + timerId = 1; raf = function() { // When timerId gets set to null at any point, this stops if ( timerId ) { diff --git a/src/event.js b/src/event.js index 131739b1..d2d57d67 100644 --- a/src/event.js +++ b/src/event.js @@ -1,6 +1,7 @@ (function( jQuery ) { -var rnamespaces = /\.(.*)$/, +var hasOwn = Object.prototype.hasOwnProperty, + rnamespaces = /\.(.*)$/, rformElems = /^(?:textarea|input|select)$/i, rperiod = /\./g, rspaces = / /g, @@ -650,27 +651,34 @@ 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 related = event.relatedTarget, - inside = false, - eventType = event.type; + var parent = event.relatedTarget; + // set the correct event type event.type = event.data; - if ( related !== this ) { + // Firefox sometimes assigns relatedTarget a XUL element + // which we cannot access the parentNode property of + try { - if ( related ) { - inside = jQuery.contains( this, related ); + // Chrome does something similar, the parentNode property + // can be accessed but is null. + if ( parent && parent !== document && !parent.parentNode ) { + return; } - if ( !inside ) { + // Traverse up the tree + while ( parent && parent !== this ) { + parent = parent.parentNode; + } + if ( parent !== this ) { + // handle event if we actually just moused on to a non sub-element jQuery.event.handle.apply( this, arguments ); - - event.type = eventType; } - } + + // assuming we've left the element since we most likely mousedover a xul element + } catch(e) { } }, // In case of event delegation, we only need to rename the event.type, diff --git a/src/outro.js b/src/outro.js index b49305e7..32b0d087 100644 --- a/src/outro.js +++ b/src/outro.js @@ -1,3 +1,2 @@ -// Expose jQuery to the global object window.jQuery = window.$ = jQuery; })(window); diff --git a/src/queue.js b/src/queue.js index 66383c19..145bfd6f 100644 --- a/src/queue.js +++ b/src/queue.js @@ -1,7 +1,7 @@ (function( jQuery ) { -function handleQueueMarkDefer( elem, type, src ) { - var deferDataKey = type + "defer", +function handleCBList( elem, type, src ) { + var deferDataKey = type + "cblst", queueDataKey = type + "queue", markDataKey = type + "mark", defer = jQuery.data( elem, deferDataKey, undefined, true ); @@ -14,7 +14,7 @@ function handleQueueMarkDefer( elem, type, src ) { if ( !jQuery.data( elem, queueDataKey, undefined, true ) && !jQuery.data( elem, markDataKey, undefined, true ) ) { jQuery.removeData( elem, deferDataKey, true ); - defer.resolve(); + defer.fireWith(); } }, 0 ); } @@ -43,7 +43,7 @@ jQuery.extend({ jQuery.data( elem, key, count, true ); } else { jQuery.removeData( elem, key, true ); - handleQueueMarkDefer( elem, type, "mark" ); + handleCBList( elem, type, "mark" ); } } }, @@ -90,7 +90,7 @@ jQuery.extend({ if ( !queue.length ) { jQuery.removeData( elem, type + "queue", true ); - handleQueueMarkDefer( elem, type, "queue" ); + handleCBList( elem, type, "queue" ); } } }); @@ -146,7 +146,7 @@ jQuery.fn.extend({ elements = this, i = elements.length, count = 1, - deferDataKey = type + "defer", + deferDataKey = type + "cblst", queueDataKey = type + "queue", markDataKey = type + "mark", tmp; @@ -159,9 +159,9 @@ jQuery.fn.extend({ if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) || ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) || jQuery.data( elements[ i ], markDataKey, undefined, true ) ) && - jQuery.data( elements[ i ], deferDataKey, jQuery._Deferred(), true ) )) { + jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) { count++; - tmp.done( resolve ); + tmp.add( resolve ); } } resolve(); diff --git a/src/support.js b/src/support.js index 882b84a2..42108ded 100644 --- a/src/support.js +++ b/src/support.js @@ -245,7 +245,7 @@ jQuery.support = (function() { } // Null connected elements to avoid leaks in IE - testElement = fragment = select = opt = body = marginDiv = div = input = null; + marginDiv = div = input = null; return support; })(); diff --git a/src/topic.js b/src/topic.js new file mode 100644 index 00000000..c856db8c --- /dev/null +++ b/src/topic.js @@ -0,0 +1,45 @@ +(function( jQuery ) { + + var topics = {}, + sliceTopic = [].slice; + + jQuery.Topic = function( id ) { + var callbacks, + method, + topic = id && topics[ id ]; + if ( !topic ) { + callbacks = jQuery.Callbacks(); + topic = { + publish: callbacks.fire, + subscribe: callbacks.add, + unsubscribe: callbacks.remove + }; + if ( id ) { + topics[ id ] = topic; + } + } + return topic; + }; + + jQuery.extend({ + subscribe: function( id ) { + var topic = jQuery.Topic( id ), + args = sliceTopic.call( arguments, 1 ); + topic.subscribe.apply( topic, args ); + return { + topic: topic, + args: args + }; + }, + unsubscribe: function( id ) { + var topic = id && id.topic || jQuery.Topic( id ); + topic.unsubscribe.apply( topic, id && id.args || + sliceTopic.call( arguments, 1 ) ); + }, + publish: function( id ) { + var topic = jQuery.Topic( id ); + topic.publish.apply( topic, sliceTopic.call( arguments, 1 ) ); + } + }); + +})( jQuery ); diff --git a/test/abortonunload.php b/test/abortonunload.php new file mode 100644 index 00000000..2bcec853 --- /dev/null +++ b/test/abortonunload.php @@ -0,0 +1,114 @@ + + + + + jQuery Abort-On-Unload Test + + + + + + + + + + + + + + + + + + + + + + + + +

+ jQuery Abort-On-Unload Test +

+
+ This page tests a fix that will abort requests on abort so that Internet Explorer + does not keep connections alive. +
+
+ In this situation, no callback should be triggered. +
+
Take the following steps:
+
    +
  1. + open the console, +
  2. +
  3. + set it to persistent mode if available, +
  4. +
  5. + click this + + to make a request and trigger the beforeunload event, +
  6. +
  7. + then either: +
      +
    1. + wait for the request to complete then cancel unload, +
    2. +
    3. + fire unload (you have 10 seconds to do so). +
    4. +
    +
  8. +
+
+ Test passes if: +
    +
  1. + you get a "success" logged, +
  2. +
  3. + you get no "error" log and no alert. +
  4. +
+
+ + \ No newline at end of file diff --git a/test/data/dashboard.xml b/test/data/dashboard.xml index 5a6f5614..10f6b334 100644 --- a/test/data/dashboard.xml +++ b/test/data/dashboard.xml @@ -1,7 +1,7 @@ - + diff --git a/test/data/offset/absolute.html b/test/data/offset/absolute.html index 9d7990a3..2002a535 100644 --- a/test/data/offset/absolute.html +++ b/test/data/offset/absolute.html @@ -16,7 +16,7 @@ #positionTest { position: absolute; } - + diff --git a/test/data/offset/body.html b/test/data/offset/body.html index 8dbf282d..a661637f 100644 --- a/test/data/offset/body.html +++ b/test/data/offset/body.html @@ -9,7 +9,7 @@ #marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; } - + diff --git a/test/data/offset/fixed.html b/test/data/offset/fixed.html index 81ba4ca7..c6eb9277 100644 --- a/test/data/offset/fixed.html +++ b/test/data/offset/fixed.html @@ -13,7 +13,7 @@ #marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; } - + diff --git a/test/data/offset/relative.html b/test/data/offset/relative.html index 280a2fc0..6386eebd 100644 --- a/test/data/offset/relative.html +++ b/test/data/offset/relative.html @@ -11,7 +11,7 @@ #marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; } - + diff --git a/test/data/offset/scroll.html b/test/data/offset/scroll.html index a0d1f4d1..0890d0ad 100644 --- a/test/data/offset/scroll.html +++ b/test/data/offset/scroll.html @@ -14,7 +14,7 @@ #marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; } - + diff --git a/test/data/offset/static.html b/test/data/offset/static.html index a61b6d10..687e93e8 100644 --- a/test/data/offset/static.html +++ b/test/data/offset/static.html @@ -11,7 +11,7 @@ #marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; } - + diff --git a/test/data/offset/table.html b/test/data/offset/table.html index 11fb0e79..06774325 100644 --- a/test/data/offset/table.html +++ b/test/data/offset/table.html @@ -11,7 +11,7 @@ #marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; } - + diff --git a/test/data/testsuite.css b/test/data/testsuite.css index 295740f5..47caf34a 100644 --- a/test/data/testsuite.css +++ b/test/data/testsuite.css @@ -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://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif) no-repeat -1000px 0; } +body, div { background: url(http://www.ctemploymentlawblog.com/test.jpg) no-repeat -1000px 0; } diff --git a/test/delegatetest.html b/test/delegatetest.html index 169e60f7..7d891b95 100644 --- a/test/delegatetest.html +++ b/test/delegatetest.html @@ -182,16 +182,16 @@ BUTTON DOCUMENT - - + +

Mouseleave Tests

-

Count mouse leave event

-
-

mouse over here should not trigger the counter.

-
-

0

+

Count mouse leave event

+
+

mouse over here should not trigger the counter.

+
+

0

    diff --git a/test/index.html b/test/index.html index 4b4c9855..0314092a 100644 --- a/test/index.html +++ b/test/index.html @@ -9,6 +9,8 @@ + + @@ -34,8 +36,10 @@ - + + + diff --git a/test/qunit b/test/qunit index d4f23f8a..d97b37ec 160000 --- a/test/qunit +++ b/test/qunit @@ -1 +1 @@ -Subproject commit d4f23f8a882d13b71768503e2db9fa33ef169ba0 +Subproject commit d97b37ec322136406790e75d03333559f38bbecb diff --git a/test/unit/ajax.js b/test/unit/ajax.js index 33433922..9f084136 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -321,40 +321,25 @@ test("jQuery.ajax() - responseText on error", function() { test(".ajax() - retry with jQuery.ajax( this )", function() { - expect( 2 ); + expect( 1 ); stop(); - var firstTime = true, - previousUrl; + var firstTime = 1; jQuery.ajax({ url: url("data/errorWithText.php"), error: function() { if ( firstTime ) { - firstTime = false; + firstTime = 0; jQuery.ajax( this ); } else { ok( true , "Test retrying with jQuery.ajax(this) works" ); - 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 ); - } - }); + start(); } } }); + }); test(".ajax() - headers" , function() { diff --git a/test/unit/attributes.js b/test/unit/attributes.js index 4716e5b5..cd8d7777 100644 --- a/test/unit/attributes.js +++ b/test/unit/attributes.js @@ -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 @@ -57,7 +57,7 @@ test("attr(String)", function() { equals( jQuery("
    ").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("").appendTo("#testForm"); equals( jQuery("#form").attr("action","newformaction").attr("action"), "newformaction", "Check that action attribute was changed" ); @@ -67,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" ); @@ -132,12 +132,11 @@ test("attr(String)", function() { if ( !isLocal ) { test("attr(String) in XML Files", function() { - expect(3); + expect(2); stop(); jQuery.get("data/dashboard.xml", function( xml ) { - 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" ); + 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(); }); }); @@ -249,7 +248,7 @@ test("attr(String, Object)", function() { commentNode = document.createComment("some comment"), textNode = document.createTextNode("some text"), obj = {}; - + jQuery.each( [commentNode, textNode, attributeNode], function( i, elem ) { var $elem = jQuery( elem ); $elem.attr( "nonexisting", "foo" ); @@ -289,7 +288,7 @@ test("attr(String, Object)", function() { j.removeAttr("name"); QUnit.reset(); - + // Type var type = jQuery("#check2").attr("type"); var thrown = false; @@ -451,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"); @@ -608,11 +607,11 @@ test("val()", function() { var $button = jQuery("").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("