Permalink
Browse files

Release: remove revert artefacts

  • Loading branch information...
markelog committed Nov 13, 2015
1 parent 2d9d1f0 commit c69673fe41ee17f46545e87a31ff96cea6c68a17
View
@@ -120,6 +120,7 @@ jQuery.fn.extend( {
// will result in `undefined` for elem = this[ 0 ] which will
// throw an exception if an attempt to read a data cache is made.
if ( elem && value === undefined ) {
+
// Attempt to get data from the cache
// with the key as-is
data = dataUser.get( elem, key );
@@ -128,6 +129,7 @@ jQuery.fn.extend( {
}
camelKey = jQuery.camelCase( key );
+
// Attempt to get data from the cache
// with the key camelized
data = dataUser.get( elem, camelKey );
@@ -148,7 +150,8 @@ jQuery.fn.extend( {
// Set the data...
camelKey = jQuery.camelCase( key );
- this.each(function() {
+ this.each( function() {
+
// First, attempt to store a copy or reference of any
// data that might've been store with a camelCased key.
var data = dataUser.get( this, camelKey );
@@ -161,10 +164,10 @@ jQuery.fn.extend( {
// *... In the case of properties that might _actually_
// have dashes, we need to also store a copy of that
// unchanged property.
- if ( key.indexOf("-") > -1 && data !== undefined ) {
+ if ( key.indexOf( "-" ) > -1 && data !== undefined ) {
dataUser.set( this, key, value );
}
- });
+ } );
}, null, value, arguments.length > 1, null, true );
},
View
@@ -28,11 +28,12 @@ Data.prototype = {
value: value,
writable: true,
configurable: true
- });
+ } );
}
return owner[ this.expando ];
},
- cache: function( owner, initial ) {
+ cache: function( owner ) {
+
// We can accept data for non-element nodes in modern browsers,
// but we should not, see #8335.
// Always return an empty object.
@@ -81,6 +82,7 @@ Data.prototype = {
// Handle: [ owner, { properties } ] args
} else {
+
// Copy the properties one-by-one to the cache object
for ( prop in data ) {
cache[ prop ] = data[ prop ];
@@ -91,10 +93,11 @@ Data.prototype = {
get: function( owner, key ) {
return key === undefined ?
this.cache( owner ) :
- owner[ this.expando ] && owner[ this.expando ][ key ]
+ owner[ this.expando ] && owner[ this.expando ][ key ];
},
access: function( owner, key, value ) {
var stored;
+
// In cases where either:
//
// 1. No key was specified
@@ -107,12 +110,12 @@ Data.prototype = {
// 2. The data stored at the key
//
if ( key === undefined ||
- ((key && typeof key === "string") && value === undefined) ) {
+ ( ( key && typeof key === "string" ) && value === undefined ) ) {
stored = this.get( owner, key );
return stored !== undefined ?
- stored : this.get( owner, jQuery.camelCase(key) );
+ stored : this.get( owner, jQuery.camelCase( key ) );
}
// When the key is not a string, or both a key and value
@@ -139,8 +142,10 @@ Data.prototype = {
this.register( owner );
} else {
+
// Support array or space separated string of keys
if ( jQuery.isArray( key ) ) {
+
// If "name" is an array of keys...
// When data is initially created, via ("key", "val") signature,
// keys will be converted to camelCase.
@@ -150,10 +155,12 @@ Data.prototype = {
name = key.concat( key.map( jQuery.camelCase ) );
} else {
camel = jQuery.camelCase( key );
+
// Try the string as a key before any manipulation
if ( key in cache ) {
name = [ key, camel ];
} else {
+
// If a key with the spaces exists, use it.
// Otherwise, create an array by matching non-whitespace
name = camel;
View
@@ -4,14 +4,15 @@ define( [
"./callbacks"
], function( jQuery, slice ) {
-jQuery.extend({
+jQuery.extend( {
Deferred: function( func ) {
var tuples = [
+
// action, add listener, listener list, final state
- [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
- [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
- [ "notify", "progress", jQuery.Callbacks("memory") ]
+ [ "resolve", "done", jQuery.Callbacks( "once memory" ), "resolved" ],
+ [ "reject", "fail", jQuery.Callbacks( "once memory" ), "rejected" ],
+ [ "notify", "progress", jQuery.Callbacks( "memory" ) ]
],
state = "pending",
promise = {
@@ -24,11 +25,12 @@ jQuery.extend({
},
then: function( /* fnDone, fnFail, fnProgress */ ) {
var fns = arguments;
- return jQuery.Deferred(function( newDefer ) {
+ return jQuery.Deferred( function( newDefer ) {
jQuery.each( tuples, function( i, tuple ) {
var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
+
// deferred[ done | fail | progress ] for forwarding actions to newDefer
- deferred[ tuple[1] ](function() {
+ deferred[ tuple[ 1 ] ]( function() {
var returned = fn && fn.apply( this, arguments );
if ( returned && jQuery.isFunction( returned.promise ) ) {
returned.promise()
@@ -46,6 +48,7 @@ jQuery.extend({
fns = null;
} ).promise();
},
+
// Get a promise for this deferred
// If obj is provided, the promise aspect is added to the object
promise: function( obj ) {
@@ -63,11 +66,12 @@ jQuery.extend({
stateString = tuple[ 3 ];
// promise[ done | fail | progress ] = list.add
- promise[ tuple[1] ] = list.add;
+ promise[ tuple[ 1 ] ] = list.add;
// Handle state
if ( stateString ) {
- list.add(function() {
+ list.add( function() {
+
// state = [ resolved | rejected ]
state = stateString;
@@ -76,12 +80,13 @@ jQuery.extend({
}
// deferred[ resolve | reject | notify ]
- deferred[ tuple[0] ] = function() {
- deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
+ deferred[ tuple[ 0 ] ] = function() {
+ deferred[ tuple[ 0 ] + "With" ]( this === deferred ? promise : this, arguments );
return this;
};
- deferred[ tuple[0] + "With" ] = list.fireWith;
- });
+ deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
+ } );
+
// Make the deferred a promise
promise.promise( deferred );
View
@@ -77,9 +77,9 @@ jQuery.fn.extend( {
if ( arguments.length ) {
return options === undefined ?
this :
- this.each(function( i ) {
+ this.each( function( i ) {
jQuery.offset.setOffset( this, options, i );
- });
+ } );
}
var docElem, win,
View
@@ -64,11 +64,11 @@ jQuery.fn.extend( {
},
unwrap: function() {
- return this.parent().each(function() {
+ return this.parent().each( function() {
if ( !jQuery.nodeName( this, "body" ) ) {
jQuery( this ).replaceWith( this.childNodes );
}
- }).end();
+ } ).end();
}
} );
View
@@ -1 +1 @@
-{bad: toTheBone}
+{bad: toTheBone;}
View
@@ -269,6 +269,7 @@ this.iframeCallback = undefined;
// Tests are always loaded async
QUnit.config.autostart = false;
this.loadTests = function() {
+
// Leverage QUnit URL parsing to detect testSwarm environment and "basic" testing mode
var loadSwarm = ( QUnit.urlParams[ "swarmURL" ] + "" ).indexOf( "http" ) === 0,
basicTests = ( QUnit.urlParams[ "module" ] + "" ) === "basic";
@@ -277,6 +278,7 @@ this.loadTests = function() {
require( [ "data/testrunner.js" ], function() {
var i = 0,
tests = [
+
// A special module with basic tests, meant for
// not fully supported environments like Android 2.3,
// jsdom or PhantomJS. We run it everywhere, though,
View
@@ -1586,11 +1586,11 @@ if ( typeof window.ArrayBuffer === "undefined" || typeof new XMLHttpRequest().re
} else {
// No built-in support for binary data, but it's easy to add via a prefilter
- jQuery.ajaxPrefilter( "arraybuffer", function ( s ) {
+ jQuery.ajaxPrefilter( "arraybuffer", function( s ) {
s.xhrFields = { responseType: "arraybuffer" };
s.responseFields.arraybuffer = "response";
s.converters[ "binary arraybuffer" ] = true;
- });
+ } );
ajaxTest( "gh-2498 - jQuery.ajax() - binary data shouldn't throw an exception", 2, function( assert ) {
return {
@@ -1828,7 +1828,7 @@ if ( typeof window.ArrayBuffer === "undefined" || typeof new XMLHttpRequest().re
url: url( "data/ajax/content-type.php" ),
data: {
"content-type": "test/jsontest",
- "response": JSON.stringify({test: "test"})
+ "response": JSON.stringify( { test: "test" } )
},
success: function( result ) {
assert.strictEqual(
View
@@ -737,9 +737,9 @@ QUnit.test( "prop('tabindex')", function( assert ) {
QUnit.test( "image.prop( 'tabIndex' )", function( assert ) {
assert.expect( 1 );
- var image = jQuery("<img src='data/1x1.jpg' />")
- .appendTo("#qunit-fixture");
- assert.equal( image.prop("tabIndex" ), -1, "tabIndex on image" );
+ var image = jQuery( "<img src='data/1x1.jpg' />" )
+ .appendTo( "#qunit-fixture" );
+ assert.equal( image.prop( "tabIndex" ), -1, "tabIndex on image" );
} );
QUnit.test( "prop('tabindex', value)", function( assert ) {
View
@@ -38,7 +38,7 @@ QUnit.test( "jQuery()", function( assert ) {
}
if ( jQuery.fn.offset ) {
expected++;
- attrObj["offset"] = { "top": 1, "left": 1 };
+ attrObj[ "offset" ] = { "top": 1, "left": 1 };
}
if ( jQuery.fn.css ) {
expected += 2;
@@ -95,7 +95,7 @@ QUnit.test( "jQuery()", function( assert ) {
assert.equal( div.length, 4, "Correct number of elements generated for div hr code b" );
assert.equal( div.parent().length, 0, "Make sure that the generated HTML has no parent." );
- assert.equal( jQuery( [ 1,2,3 ] ).get( 1 ), 2, "Test passing an array to the factory" );
+ assert.equal( jQuery( [ 1, 2, 3 ] ).get( 1 ), 2, "Test passing an array to the factory" );
assert.equal( jQuery( document.body ).get( 0 ), jQuery( "body" ).get( 0 ), "Test passing an html node to the factory" );
@@ -105,14 +105,14 @@ QUnit.test( "jQuery()", function( assert ) {
elem = jQuery( "\n\n<em>world</em>" )[ 0 ];
assert.equal( elem.nodeName.toLowerCase(), "em", "leading newlines" );
- elem = jQuery("<div/>", attrObj );
+ elem = jQuery( "<div/>", attrObj );
if ( jQuery.fn.width ) {
assert.equal( elem[ 0 ].style.width, "10px", "jQuery() quick setter width" );
}
if ( jQuery.fn.offset ) {
- equal( elem[0].style.top, "1px", "jQuery() quick setter offset");
+ assert.equal( elem[ 0 ].style.top, "1px", "jQuery() quick setter offset" );
}
if ( jQuery.fn.css ) {
@@ -273,8 +273,9 @@ QUnit.test( "type", function( assert ) {
} );
QUnit.test( "type for `Symbol`", function( assert ) {
+
// Prevent reference errors
- if( typeof Symbol !== "function" ) {
+ if ( typeof Symbol !== "function" ) {
assert.expect( 0 );
return;
}
@@ -283,7 +284,7 @@ QUnit.test( "type for `Symbol`", function( assert ) {
assert.equal( jQuery.type( Symbol() ), "symbol", "Symbol" );
assert.equal( jQuery.type( Object( Symbol() ) ), "symbol", "Symbol" );
-});
+} );
QUnit.asyncTest( "isPlainObject", function( assert ) {
assert.expect( 15 );
@@ -361,7 +362,6 @@ QUnit[ typeof Symbol === "function" ? "test" : "skip" ]( "isPlainObject(Symbol)"
assert.equal( jQuery.isPlainObject( Object( Symbol() ) ), false, "Symbol inside an object" );
} );
-
QUnit.test( "isFunction", function( assert ) {
assert.expect( 19 );
@@ -913,7 +913,7 @@ QUnit.test( "jQuery.map", function( assert ) {
assert.ok( !result, "empty NodeList treated like array" );
result = jQuery.map( Array( 4 ), function( v, k ) {
- return k % 2 ? k : [ k,k,k ];
+ return k % 2 ? k : [ k, k, k ];
} );
assert.equal( result.join( "" ), "00012223", "Array results flattened (#2616)" );
} );
@@ -1065,7 +1065,7 @@ QUnit.test( "jQuery.grep(Array-like)", function( assert ) {
[],
"Satisfying elements absent, Array-like object used, and grep explicitly uninverted"
);
-});
+} );
QUnit.test( "jQuery.extend(Object, Object)", function( assert ) {
assert.expect( 28 );
@@ -1183,19 +1183,19 @@ QUnit.test( "jQuery.extend(Object, Object)", function( assert ) {
QUnit.test( "jQuery.extend(Object, Object {created with \"defineProperties\"})", function( assert ) {
assert.expect( 2 );
- var definedObj = Object.defineProperties({}, {
+ var definedObj = Object.defineProperties( {}, {
"enumerableProp": {
- get: function () {
+ get: function() {
return true;
},
enumerable: true
},
"nonenumerableProp": {
- get: function () {
+ get: function() {
return true;
}
}
- }),
+ } ),
accessorObj = {};
jQuery.extend( accessorObj, definedObj );
@@ -1253,7 +1253,7 @@ QUnit.test( "jQuery.each(Object,Function)", function( assert ) {
assert.deepEqual( seen, [ 1, 2 ], "Broken array iteration" );
seen = [];
- jQuery.each( { "a": 1, "b": 2,"c": 3 }, function( k, v ) {
+ jQuery.each( { "a": 1, "b": 2, "c": 3 }, function( k, v ) {
seen.push( v );
return false;
} );
@@ -1373,7 +1373,7 @@ QUnit.test( "jQuery.makeArray", function( assert ) {
assert.equal( ( function() { return jQuery.makeArray( arguments ); } )( 1, 2 ).join( "" ), "12", "Pass makeArray an arguments array" );
- assert.equal( jQuery.makeArray( [ 1,2,3 ] ).join( "" ), "123", "Pass makeArray a real array" );
+ assert.equal( jQuery.makeArray( [ 1, 2, 3 ] ).join( "" ), "123", "Pass makeArray a real array" );
assert.equal( jQuery.makeArray().length, 0, "Pass nothing to makeArray and expect an empty array" );
Oops, something went wrong.

0 comments on commit c69673f

Please sign in to comment.