mirror of
https://github.com/jquery/jquery.git
synced 2025-01-10 18:24:24 +00:00
Make sure that when multiple variables are being declared that assignments are each done on their own line.
This commit is contained in:
parent
b5b3c73db3
commit
fb48ae8e6c
11
src/ajax.js
11
src/ajax.js
@ -506,11 +506,12 @@ jQuery.extend({
|
|||||||
// Serialize an array of form elements or a set of
|
// Serialize an array of form elements or a set of
|
||||||
// key/values into a query string
|
// key/values into a query string
|
||||||
param: function( a, traditional ) {
|
param: function( a, traditional ) {
|
||||||
var s = [], add = function( key, value ) {
|
var s = [],
|
||||||
// If value is a function, invoke it and return its value
|
add = function( key, value ) {
|
||||||
value = jQuery.isFunction(value) ? value() : value;
|
// If value is a function, invoke it and return its value
|
||||||
s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
|
value = jQuery.isFunction(value) ? value() : value;
|
||||||
};
|
s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
|
||||||
|
};
|
||||||
|
|
||||||
// Set traditional to true for jQuery <= 1.3.2 behavior.
|
// Set traditional to true for jQuery <= 1.3.2 behavior.
|
||||||
if ( traditional === undefined ) {
|
if ( traditional === undefined ) {
|
||||||
|
@ -55,7 +55,9 @@ jQuery.fn.extend({
|
|||||||
elem.className = value;
|
elem.className = value;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
var className = " " + elem.className + " ", setClass = elem.className;
|
var className = " " + elem.className + " ",
|
||||||
|
setClass = elem.className;
|
||||||
|
|
||||||
for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
|
for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
|
||||||
if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) {
|
if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) {
|
||||||
setClass += " " + classNames[c];
|
setClass += " " + classNames[c];
|
||||||
@ -103,7 +105,8 @@ jQuery.fn.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
toggleClass: function( value, stateVal ) {
|
toggleClass: function( value, stateVal ) {
|
||||||
var type = typeof value, isBool = typeof stateVal === "boolean";
|
var type = typeof value,
|
||||||
|
isBool = typeof stateVal === "boolean";
|
||||||
|
|
||||||
if ( jQuery.isFunction( value ) ) {
|
if ( jQuery.isFunction( value ) ) {
|
||||||
return this.each(function(i) {
|
return this.each(function(i) {
|
||||||
@ -115,7 +118,9 @@ jQuery.fn.extend({
|
|||||||
return this.each(function() {
|
return this.each(function() {
|
||||||
if ( type === "string" ) {
|
if ( type === "string" ) {
|
||||||
// toggle individual class names
|
// toggle individual class names
|
||||||
var className, i = 0, self = jQuery(this),
|
var className,
|
||||||
|
i = 0,
|
||||||
|
self = jQuery( this ),
|
||||||
state = stateVal,
|
state = stateVal,
|
||||||
classNames = value.split( rspaces );
|
classNames = value.split( rspaces );
|
||||||
|
|
||||||
|
10
src/core.js
10
src/core.js
@ -311,8 +311,11 @@ jQuery.fn = jQuery.prototype = {
|
|||||||
jQuery.fn.init.prototype = jQuery.fn;
|
jQuery.fn.init.prototype = jQuery.fn;
|
||||||
|
|
||||||
jQuery.extend = jQuery.fn.extend = function() {
|
jQuery.extend = jQuery.fn.extend = function() {
|
||||||
// copy reference to target object
|
var options, name, src, copy, copyIsArray, clone,
|
||||||
var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options, name, src, copy, copyIsArray, clone;
|
target = arguments[0] || {},
|
||||||
|
i = 1,
|
||||||
|
length = arguments.length,
|
||||||
|
deep = false;
|
||||||
|
|
||||||
// Handle a deep copy situation
|
// Handle a deep copy situation
|
||||||
if ( typeof target === "boolean" ) {
|
if ( typeof target === "boolean" ) {
|
||||||
@ -678,7 +681,8 @@ jQuery.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
merge: function( first, second ) {
|
merge: function( first, second ) {
|
||||||
var i = first.length, j = 0;
|
var i = first.length,
|
||||||
|
j = 0;
|
||||||
|
|
||||||
if ( typeof second.length === "number" ) {
|
if ( typeof second.length === "number" ) {
|
||||||
for ( var l = second.length; j < l; j++ ) {
|
for ( var l = second.length; j < l; j++ ) {
|
||||||
|
@ -258,7 +258,9 @@ if ( document.defaultView && document.defaultView.getComputedStyle ) {
|
|||||||
|
|
||||||
if ( document.documentElement.currentStyle ) {
|
if ( document.documentElement.currentStyle ) {
|
||||||
currentStyle = function( elem, name ) {
|
currentStyle = function( elem, name ) {
|
||||||
var left, rsLeft, ret = elem.currentStyle && elem.currentStyle[ name ], style = elem.style;
|
var left, rsLeft,
|
||||||
|
ret = elem.currentStyle && elem.currentStyle[ name ],
|
||||||
|
style = elem.style;
|
||||||
|
|
||||||
// From the awesome hack by Dean Edwards
|
// From the awesome hack by Dean Edwards
|
||||||
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
|
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
|
||||||
@ -312,7 +314,8 @@ function getWH( elem, name, extra ) {
|
|||||||
|
|
||||||
if ( jQuery.expr && jQuery.expr.filters ) {
|
if ( jQuery.expr && jQuery.expr.filters ) {
|
||||||
jQuery.expr.filters.hidden = function( elem ) {
|
jQuery.expr.filters.hidden = function( elem ) {
|
||||||
var width = elem.offsetWidth, height = elem.offsetHeight;
|
var width = elem.offsetWidth,
|
||||||
|
height = elem.offsetHeight;
|
||||||
|
|
||||||
return (width === 0 && height === 0) || (!jQuery.support.reliableHiddenOffsets && (elem.style.display || jQuery.css( elem, "display" )) === "none");
|
return (width === 0 && height === 0) || (!jQuery.support.reliableHiddenOffsets && (elem.style.display || jQuery.css( elem, "display" )) === "none");
|
||||||
};
|
};
|
||||||
|
@ -177,7 +177,8 @@ jQuery.fn.extend({
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
return this.each(function() {
|
return this.each(function() {
|
||||||
var $this = jQuery( this ), args = [ parts[0], value ];
|
var $this = jQuery( this ),
|
||||||
|
args = [ parts[0], value ];
|
||||||
|
|
||||||
$this.triggerHandler( "setData" + parts[1] + "!", args );
|
$this.triggerHandler( "setData" + parts[1] + "!", args );
|
||||||
jQuery.data( this, key, value );
|
jQuery.data( this, key, value );
|
||||||
|
@ -49,7 +49,9 @@ jQuery.each([ "Height", "Width" ], function( i, name ) {
|
|||||||
|
|
||||||
// Get or set width or height on the element
|
// Get or set width or height on the element
|
||||||
} else if ( size === undefined ) {
|
} else if ( size === undefined ) {
|
||||||
var orig = jQuery.css( elem, type ), ret = parseFloat( orig );
|
var orig = jQuery.css( elem, type ),
|
||||||
|
ret = parseFloat( orig );
|
||||||
|
|
||||||
return jQuery.isNaN( ret ) ? orig : ret;
|
return jQuery.isNaN( ret ) ? orig : ret;
|
||||||
|
|
||||||
// Set the width or height on the element (default to pixels if value is unitless)
|
// Set the width or height on the element (default to pixels if value is unitless)
|
||||||
|
8
src/effects.js
vendored
8
src/effects.js
vendored
@ -342,6 +342,9 @@ jQuery.fx.prototype = {
|
|||||||
|
|
||||||
// Start an animation from one number to another
|
// Start an animation from one number to another
|
||||||
custom: function( from, to, unit ) {
|
custom: function( from, to, unit ) {
|
||||||
|
var self = this,
|
||||||
|
fx = jQuery.fx;
|
||||||
|
|
||||||
this.startTime = jQuery.now();
|
this.startTime = jQuery.now();
|
||||||
this.start = from;
|
this.start = from;
|
||||||
this.end = to;
|
this.end = to;
|
||||||
@ -349,7 +352,6 @@ jQuery.fx.prototype = {
|
|||||||
this.now = this.start;
|
this.now = this.start;
|
||||||
this.pos = this.state = 0;
|
this.pos = this.state = 0;
|
||||||
|
|
||||||
var self = this, fx = jQuery.fx;
|
|
||||||
function t( gotoEnd ) {
|
function t( gotoEnd ) {
|
||||||
return self.step(gotoEnd);
|
return self.step(gotoEnd);
|
||||||
}
|
}
|
||||||
@ -406,7 +408,9 @@ jQuery.fx.prototype = {
|
|||||||
if ( done ) {
|
if ( done ) {
|
||||||
// Reset the overflow
|
// Reset the overflow
|
||||||
if ( this.options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
|
if ( this.options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
|
||||||
var elem = this.elem, options = this.options;
|
var elem = this.elem,
|
||||||
|
options = this.options;
|
||||||
|
|
||||||
jQuery.each( [ "", "X", "Y" ], function (index, value) {
|
jQuery.each( [ "", "X", "Y" ], function (index, value) {
|
||||||
elem.style[ "overflow" + value ] = options.overflow[index];
|
elem.style[ "overflow" + value ] = options.overflow[index];
|
||||||
} );
|
} );
|
||||||
|
28
src/event.js
28
src/event.js
@ -378,8 +378,10 @@ jQuery.event = {
|
|||||||
jQuery.event.trigger( event, data, parent, true );
|
jQuery.event.trigger( event, data, parent, true );
|
||||||
|
|
||||||
} else if ( !event.isDefaultPrevented() ) {
|
} else if ( !event.isDefaultPrevented() ) {
|
||||||
var target = event.target, old, targetType = type.replace(rnamespaces, ""),
|
var old,
|
||||||
isClick = jQuery.nodeName(target, "a") && targetType === "click",
|
target = event.target,
|
||||||
|
targetType = type.replace( rnamespaces, "" ),
|
||||||
|
isClick = jQuery.nodeName( target, "a" ) && targetType === "click",
|
||||||
special = jQuery.event.special[ targetType ] || {};
|
special = jQuery.event.special[ targetType ] || {};
|
||||||
|
|
||||||
if ( (!special._default || special._default.call( elem, event ) === false) &&
|
if ( (!special._default || special._default.call( elem, event ) === false) &&
|
||||||
@ -411,7 +413,9 @@ jQuery.event = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
handle: function( event ) {
|
handle: function( event ) {
|
||||||
var all, handlers, namespaces, namespace_sort = [], namespace_re, events, args = jQuery.makeArray( arguments );
|
var all, handlers, namespaces, namespace_re, events,
|
||||||
|
namespace_sort = [],
|
||||||
|
args = jQuery.makeArray( arguments );
|
||||||
|
|
||||||
event = args[0] = jQuery.event.fix( event || window.event );
|
event = args[0] = jQuery.event.fix( event || window.event );
|
||||||
event.currentTarget = this;
|
event.currentTarget = this;
|
||||||
@ -506,7 +510,9 @@ jQuery.event = {
|
|||||||
|
|
||||||
// Calculate pageX/Y if missing and clientX/Y available
|
// Calculate pageX/Y if missing and clientX/Y available
|
||||||
if ( event.pageX == null && event.clientX != null ) {
|
if ( event.pageX == null && event.clientX != null ) {
|
||||||
var doc = document.documentElement, body = document.body;
|
var doc = document.documentElement,
|
||||||
|
body = document.body;
|
||||||
|
|
||||||
event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
|
event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
|
||||||
event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
|
event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
|
||||||
}
|
}
|
||||||
@ -712,7 +718,8 @@ if ( !jQuery.support.submitBubbles ) {
|
|||||||
setup: function( data, namespaces ) {
|
setup: function( data, namespaces ) {
|
||||||
if ( this.nodeName.toLowerCase() !== "form" ) {
|
if ( this.nodeName.toLowerCase() !== "form" ) {
|
||||||
jQuery.event.add(this, "click.specialSubmit", function( e ) {
|
jQuery.event.add(this, "click.specialSubmit", function( e ) {
|
||||||
var elem = e.target, type = elem.type;
|
var elem = e.target,
|
||||||
|
type = elem.type;
|
||||||
|
|
||||||
if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {
|
if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {
|
||||||
e.liveFired = undefined;
|
e.liveFired = undefined;
|
||||||
@ -721,7 +728,8 @@ if ( !jQuery.support.submitBubbles ) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
jQuery.event.add(this, "keypress.specialSubmit", function( e ) {
|
jQuery.event.add(this, "keypress.specialSubmit", function( e ) {
|
||||||
var elem = e.target, type = elem.type;
|
var elem = e.target,
|
||||||
|
type = elem.type;
|
||||||
|
|
||||||
if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {
|
if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {
|
||||||
e.liveFired = undefined;
|
e.liveFired = undefined;
|
||||||
@ -962,7 +970,8 @@ jQuery.fn.extend({
|
|||||||
|
|
||||||
toggle: function( fn ) {
|
toggle: function( fn ) {
|
||||||
// Save reference to arguments for access in closure
|
// Save reference to arguments for access in closure
|
||||||
var args = arguments, i = 1;
|
var args = arguments,
|
||||||
|
i = 1;
|
||||||
|
|
||||||
// link all the functions, so any of them can unbind this click handler
|
// link all the functions, so any of them can unbind this click handler
|
||||||
while ( i < args.length ) {
|
while ( i < args.length ) {
|
||||||
@ -1057,8 +1066,9 @@ jQuery.each(["live", "die"], function( i, name ) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function liveHandler( event ) {
|
function liveHandler( event ) {
|
||||||
var stop, maxLevel, elems = [], selectors = [],
|
var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret,
|
||||||
related, match, handleObj, elem, j, i, l, data, close, namespace, ret,
|
elems = [],
|
||||||
|
selectors = [],
|
||||||
events = jQuery.data( this, this.nodeType ? "events" : "__events__" );
|
events = jQuery.data( this, this.nodeType ? "events" : "__events__" );
|
||||||
|
|
||||||
if ( typeof events === "function" ) {
|
if ( typeof events === "function" ) {
|
||||||
|
@ -34,7 +34,8 @@ jQuery.fn.extend({
|
|||||||
text: function( text ) {
|
text: function( text ) {
|
||||||
if ( jQuery.isFunction(text) ) {
|
if ( jQuery.isFunction(text) ) {
|
||||||
return this.each(function(i) {
|
return this.each(function(i) {
|
||||||
var self = jQuery(this);
|
var self = jQuery( this );
|
||||||
|
|
||||||
self.text( text.call(this, i, self.text()) );
|
self.text( text.call(this, i, self.text()) );
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -83,7 +84,8 @@ jQuery.fn.extend({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return this.each(function() {
|
return this.each(function() {
|
||||||
var self = jQuery( this ), contents = self.contents();
|
var self = jQuery( this ),
|
||||||
|
contents = self.contents();
|
||||||
|
|
||||||
if ( contents.length ) {
|
if ( contents.length ) {
|
||||||
contents.wrapAll( html );
|
contents.wrapAll( html );
|
||||||
@ -194,7 +196,9 @@ jQuery.fn.extend({
|
|||||||
// attributes in IE that are actually only stored
|
// attributes in IE that are actually only stored
|
||||||
// as properties will not be copied (such as the
|
// as properties will not be copied (such as the
|
||||||
// the name attribute on an input).
|
// the name attribute on an input).
|
||||||
var html = this.outerHTML, ownerDocument = this.ownerDocument;
|
var html = this.outerHTML,
|
||||||
|
ownerDocument = this.ownerDocument;
|
||||||
|
|
||||||
if ( !html ) {
|
if ( !html ) {
|
||||||
var div = ownerDocument.createElement("div");
|
var div = ownerDocument.createElement("div");
|
||||||
div.appendChild( this.cloneNode(true) );
|
div.appendChild( this.cloneNode(true) );
|
||||||
@ -249,7 +253,8 @@ jQuery.fn.extend({
|
|||||||
|
|
||||||
} else if ( jQuery.isFunction( value ) ) {
|
} else if ( jQuery.isFunction( value ) ) {
|
||||||
this.each(function(i){
|
this.each(function(i){
|
||||||
var self = jQuery(this);
|
var self = jQuery( this );
|
||||||
|
|
||||||
self.html( value.call(this, i, self.html()) );
|
self.html( value.call(this, i, self.html()) );
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -272,13 +277,14 @@ jQuery.fn.extend({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( typeof value !== "string" ) {
|
if ( typeof value !== "string" ) {
|
||||||
value = jQuery(value).detach();
|
value = jQuery( value ).detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.each(function() {
|
return this.each(function() {
|
||||||
var next = this.nextSibling, parent = this.parentNode;
|
var next = this.nextSibling,
|
||||||
|
parent = this.parentNode;
|
||||||
|
|
||||||
jQuery(this).remove();
|
jQuery( this ).remove();
|
||||||
|
|
||||||
if ( next ) {
|
if ( next ) {
|
||||||
jQuery(next).before( value );
|
jQuery(next).before( value );
|
||||||
@ -296,7 +302,9 @@ jQuery.fn.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
domManip: function( args, table, callback ) {
|
domManip: function( args, table, callback ) {
|
||||||
var results, first, value = args[0], scripts = [], fragment, parent;
|
var results, first, fragment, parent,
|
||||||
|
value = args[0],
|
||||||
|
scripts = [];
|
||||||
|
|
||||||
// We can't cloneNode fragments that contain checked, in WebKit
|
// We can't cloneNode fragments that contain checked, in WebKit
|
||||||
if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
|
if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
|
||||||
@ -371,7 +379,9 @@ function cloneCopyEvent(orig, ret) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var oldData = jQuery.data( orig[i++] ), curData = jQuery.data( this, oldData ), events = oldData && oldData.events;
|
var oldData = jQuery.data( orig[i++] ),
|
||||||
|
curData = jQuery.data( this, oldData ),
|
||||||
|
events = oldData && oldData.events;
|
||||||
|
|
||||||
if ( events ) {
|
if ( events ) {
|
||||||
delete curData.handle;
|
delete curData.handle;
|
||||||
@ -428,7 +438,8 @@ jQuery.each({
|
|||||||
replaceAll: "replaceWith"
|
replaceAll: "replaceWith"
|
||||||
}, function( name, original ) {
|
}, function( name, original ) {
|
||||||
jQuery.fn[ name ] = function( selector ) {
|
jQuery.fn[ name ] = function( selector ) {
|
||||||
var ret = [], insert = jQuery( selector ),
|
var ret = [],
|
||||||
|
insert = jQuery( selector ),
|
||||||
parent = this.length === 1 && this[0].parentNode;
|
parent = this.length === 1 && this[0].parentNode;
|
||||||
|
|
||||||
if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
|
if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
|
||||||
|
@ -65,11 +65,16 @@ if ( "getBoundingClientRect" in document.documentElement ) {
|
|||||||
|
|
||||||
jQuery.offset.initialize();
|
jQuery.offset.initialize();
|
||||||
|
|
||||||
var offsetParent = elem.offsetParent, prevOffsetParent = elem,
|
var computedStyle,
|
||||||
doc = elem.ownerDocument, computedStyle, docElem = doc.documentElement,
|
offsetParent = elem.offsetParent,
|
||||||
body = doc.body, defaultView = doc.defaultView,
|
prevOffsetParent = elem,
|
||||||
|
doc = elem.ownerDocument,
|
||||||
|
docElem = doc.documentElement,
|
||||||
|
body = doc.body,
|
||||||
|
defaultView = doc.defaultView,
|
||||||
prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
|
prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
|
||||||
top = elem.offsetTop, left = elem.offsetLeft;
|
top = elem.offsetTop,
|
||||||
|
left = elem.offsetLeft;
|
||||||
|
|
||||||
while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
|
while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
|
||||||
if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
|
if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
|
||||||
@ -151,7 +156,8 @@ jQuery.offset = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
bodyOffset: function( body ) {
|
bodyOffset: function( body ) {
|
||||||
var top = body.offsetTop, left = body.offsetLeft;
|
var top = body.offsetTop,
|
||||||
|
left = body.offsetLeft;
|
||||||
|
|
||||||
jQuery.offset.initialize();
|
jQuery.offset.initialize();
|
||||||
|
|
||||||
|
@ -27,7 +27,8 @@ jQuery.extend({
|
|||||||
dequeue: function( elem, type ) {
|
dequeue: function( elem, type ) {
|
||||||
type = type || "fx";
|
type = type || "fx";
|
||||||
|
|
||||||
var queue = jQuery.queue( elem, type ), fn = queue.shift();
|
var queue = jQuery.queue( elem, type ),
|
||||||
|
fn = queue.shift();
|
||||||
|
|
||||||
// If the fx queue is dequeued, always remove the progress sentinel
|
// If the fx queue is dequeued, always remove the progress sentinel
|
||||||
if ( fn === "inprogress" ) {
|
if ( fn === "inprogress" ) {
|
||||||
|
@ -10,7 +10,8 @@ var runtil = /Until$/,
|
|||||||
|
|
||||||
jQuery.fn.extend({
|
jQuery.fn.extend({
|
||||||
find: function( selector ) {
|
find: function( selector ) {
|
||||||
var ret = this.pushStack( "", "find", selector ), length = 0;
|
var ret = this.pushStack( "", "find", selector ),
|
||||||
|
length = 0;
|
||||||
|
|
||||||
for ( var i = 0, l = this.length; i < l; i++ ) {
|
for ( var i = 0, l = this.length; i < l; i++ ) {
|
||||||
length = ret.length;
|
length = ret.length;
|
||||||
@ -59,7 +60,9 @@ jQuery.fn.extend({
|
|||||||
var ret = [], i, l, cur = this[0];
|
var ret = [], i, l, cur = this[0];
|
||||||
|
|
||||||
if ( jQuery.isArray( selectors ) ) {
|
if ( jQuery.isArray( selectors ) ) {
|
||||||
var match, matches = {}, selector, level = 1;
|
var match, selector,
|
||||||
|
matches = {},
|
||||||
|
level = 1;
|
||||||
|
|
||||||
if ( cur && selectors.length ) {
|
if ( cur && selectors.length ) {
|
||||||
for ( i = 0, l = selectors.length; i < l; i++ ) {
|
for ( i = 0, l = selectors.length; i < l; i++ ) {
|
||||||
@ -225,7 +228,9 @@ jQuery.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
dir: function( elem, dir, until ) {
|
dir: function( elem, dir, until ) {
|
||||||
var matched = [], cur = elem[dir];
|
var matched = [],
|
||||||
|
cur = elem[ dir ];
|
||||||
|
|
||||||
while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
|
while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
|
||||||
if ( cur.nodeType === 1 ) {
|
if ( cur.nodeType === 1 ) {
|
||||||
matched.push( cur );
|
matched.push( cur );
|
||||||
|
Loading…
Reference in New Issue
Block a user