Permalink
Browse files

Build: code style fixes after all those reverts

  • Loading branch information...
markelog committed Dec 22, 2015
1 parent c9546c6 commit 14eba98c8f189c2e6a36e640bedce2ce6db34493
View
@@ -5,6 +5,7 @@ define( [
"../traversing",
"../manipulation",
"../selector",
// Optional event/alias dependency
"../event/alias"
], function( jQuery ) {
View
@@ -290,6 +290,7 @@ jQuery.extend( {
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
globalEval: function( data ) {
if ( data && jQuery.trim( data ) ) {
// We use execScript on Internet Explorer
// We use an anonymous function so that context is window
// rather than jQuery in Firefox
View
@@ -79,7 +79,7 @@ var rootjQuery,
// Inject the element directly into the jQuery object
this.length = 1;
this[0] = elem;
this[ 0 ] = elem;
}
this.context = document;
@@ -99,7 +99,7 @@ var rootjQuery,
// HANDLE: $(DOMElement)
} else if ( selector.nodeType ) {
this.context = this[0] = selector;
this.context = this[ 0 ] = selector;
this.length = 1;
return this;
View
@@ -82,6 +82,7 @@ function showHide( elements, show ) {
values[ index ] = jQuery._data( elem, "olddisplay" );
display = elem.style.display;
if ( show ) {
// Reset the inline display of this element to learn if it is
// being hidden by cascaded rules or not
if ( !values[ index ] && display === "none" ) {
@@ -92,7 +93,7 @@ function showHide( elements, show ) {
// in a stylesheet to whatever the default browser style is
// for such an element
if ( elem.style.display === "" && isHidden( elem ) ) {
values[ index ] = jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) );
values[ index ] = jQuery._data( elem, "olddisplay", defaultDisplay( elem.nodeName ) );
}
} else {
hidden = isHidden( elem );
@@ -1,4 +1,4 @@
define([
define( [
"../core",
"../var/document",
"../manipulation" // appendTo
@@ -18,6 +18,7 @@ var iframe,
* @param {String} name nodeName of the element
* @param {Object} doc Document object
*/
// Called only from within defaultDisplay
function actualDisplay( name, doc ) {
var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
@@ -46,7 +47,7 @@ function defaultDisplay( nodeName ) {
if ( display === "none" || !display ) {
// Use the already-created iframe if possible
iframe = (iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" ))
iframe = ( iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" ) )
.appendTo( doc.documentElement );
// Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
@@ -68,4 +69,4 @@ function defaultDisplay( nodeName ) {
}
return defaultDisplay;
});
} );
View
@@ -47,7 +47,7 @@ function isEmptyDataObject( obj ) {
for ( name in obj ) {
// if the public data object is empty, the private is still empty
if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
if ( name === "data" && jQuery.isEmptyObject( obj[ name ] ) ) {
continue;
}
if ( name !== "toJSON" ) {
@@ -80,7 +80,7 @@ function internalData( elem, name, data, pvt /* Internal Use Only */ ) {
// Avoid doing any more work than we need to when trying to get data on an
// object that has no data at all
if ( (!id || !cache[id] || (!pvt && !cache[id].data)) &&
if ( ( !id || !cache[ id ] || ( !pvt && !cache[ id ].data ) ) &&
data === undefined && typeof name === "string" ) {
return;
}
@@ -187,10 +187,11 @@ function internalRemoveData( elem, name, pvt ) {
if ( name in thisCache ) {
name = [ name ];
} else {
name = name.split(" ");
name = name.split( " " );
}
}
} else {
// If "name" is an array of keys...
// When data is initially created, via ("key", "val") signature,
// keys will be converted to camelCase.
@@ -202,7 +203,7 @@ function internalRemoveData( elem, name, pvt ) {
i = name.length;
while ( i-- ) {
delete thisCache[ name[i] ];
delete thisCache[ name[ i ] ];
}
// If there is no data left in the cache, we want to continue
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,12 @@ 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 );
@@ -117,7 +121,7 @@ jQuery.extend({
if ( values === progressValues ) {
deferred.notifyWith( contexts, values );
} else if ( !(--remaining) ) {
} else if ( !( --remaining ) ) {
deferred.resolveWith( contexts, values );
}
};
View
@@ -103,6 +103,7 @@ function defaultPrefilter( elem, props, opts ) {
// height/width overflow pass
if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
// Make sure that nothing sneaks out
// Record all 3 overflow attributes because IE does not
// change the overflow attribute when overflowX and
@@ -171,17 +172,17 @@ function defaultPrefilter( elem, props, opts ) {
if ( hidden ) {
jQuery( elem ).show();
} else {
anim.done(function() {
anim.done( function() {
jQuery( elem ).hide();
});
} );
}
anim.done(function() {
anim.done( function() {
var prop;
jQuery._removeData( elem, "fxshow" );
for ( prop in orig ) {
jQuery.style( elem, prop, orig[ prop ] );
}
});
} );
for ( prop in orig ) {
tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
@@ -195,7 +196,7 @@ function defaultPrefilter( elem, props, opts ) {
}
// If this is a noop like .hide().hide(), restore an overwritten display value
} else if ( (display === "none" ? defaultDisplay( elem.nodeName ) : display) === "inline" ) {
} else if ( ( display === "none" ? defaultDisplay( elem.nodeName ) : display ) === "inline" ) {
style.display = display;
}
}
View
@@ -3,9 +3,9 @@ define( [
"../event"
], function( jQuery ) {
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
jQuery.each( ( "blur focus focusin focusout load resize scroll unload click dblclick " +
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
"change select submit keydown keypress keyup error contextmenu").split(" "),
"change select submit keydown keypress keyup error contextmenu" ).split( " " ),
function( i, name ) {
// Handle event binding
View
@@ -49,8 +49,8 @@ function manipulationTarget( elem, content ) {
return jQuery.nodeName( elem, "table" ) &&
jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ?
elem.getElementsByTagName("tbody")[0] ||
elem.appendChild( elem.ownerDocument.createElement("tbody") ) :
elem.getElementsByTagName( "tbody" )[ 0 ] ||
elem.appendChild( elem.ownerDocument.createElement( "tbody" ) ) :
elem;
}
View
@@ -8,17 +8,18 @@ define( [
jQuery.fn.extend( {
wrapAll: function( html ) {
if ( jQuery.isFunction( html ) ) {
return this.each(function(i) {
jQuery(this).wrapAll( html.call(this, i) );
});
return this.each( function( i ) {
jQuery( this ).wrapAll( html.call( this, i ) );
} );
}
if ( this[0] ) {
if ( this[ 0 ] ) {
// The elements to wrap the target around
var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
var wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
if ( this[0].parentNode ) {
wrap.insertBefore( this[0] );
if ( this[ 0 ].parentNode ) {
wrap.insertBefore( this[ 0 ] );
}
wrap.map( function() {
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
@@ -113,7 +113,7 @@ QUnit.module( "ajax", {
assert.ok( true, "success" );
},
fail: function() {
if (jQuery.support.cors === false) {
if ( jQuery.support.cors === false ) {
assert.ok( true, "fail" );
}
},
@@ -1418,13 +1418,15 @@ QUnit.module( "ajax", {
} );
test( "#11743 - jQuery.ajax() - script, throws exception", 1, function() {
throws(function() {
jQuery.ajax({
throws( function() {
jQuery.ajax( {
url: "data/badjson.js",
dataType: "script",
"throws": true,
// TODO find a way to test this asynchronously, too
async: false,
// Global events get confused by the exception
global: false,
success: function() {
@@ -1433,9 +1435,9 @@ QUnit.module( "ajax", {
error: function() {
ok( false, "Error." );
}
});
} );
}, "exception bubbled" );
});
} );
jQuery.each( [ "method", "type" ], function( _, globalOption ) {
function request( assert, option ) {
@@ -1654,7 +1656,7 @@ QUnit.module( "ajax", {
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
@@ -735,9 +735,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
@@ -331,7 +331,7 @@ QUnit.test( "jQuery.Callbacks.has", function( assert ) {
assert.strictEqual( cb.has(), true, "Check if unique list has callback function(s) attached" );
cb.lock();
strictEqual( cb.has(), false, "locked() list is empty and returns false" );
});
} );
QUnit.test( "jQuery.Callbacks() - adding a string doesn't cause a stack overflow", function( assert ) {
Oops, something went wrong.

0 comments on commit 14eba98

Please sign in to comment.