From 61e37d41490aed319a176c6ca7feb95e5505059c Mon Sep 17 00:00:00 2001 From: jeresig Date: Mon, 21 Dec 2009 19:58:13 -0500 Subject: [PATCH] Made a number of spacing changes to bring the code more-inline with the jQuery Core Style Guideline. --- src/ajax.js | 50 +++++++++++++++++++++------------------- src/attributes.js | 12 ++++++---- src/core.js | 11 +++++---- src/css.js | 12 +++++++--- src/data.js | 8 +++---- src/dimensions.js | 6 ++--- src/effects.js | 28 +++++++++++------------ src/event.js | 29 ++++++++++++++++-------- src/intro.js | 2 +- src/manipulation.js | 42 ++++++++++++++++++---------------- src/offset.js | 43 ++++++++++++++++++++++++++--------- src/queue.js | 34 ++++++++++++++++++--------- src/support.js | 8 +++---- src/traversing.js | 63 ++++++++++++++++++++++++++++++++++++--------------- 14 files changed, 218 insertions(+), 130 deletions(-) diff --git a/src/ajax.js b/src/ajax.js index edb5c54..0d1dd84 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -52,7 +52,7 @@ jQuery.fn.extend({ dataType: "html", data: params, context:this, - complete: function(res, status){ + complete: function( res, status ) { // If successful, inject the HTML into all the matched elements if ( status === "success" || status === "notmodified" ) { // See if a selector was specified @@ -83,31 +83,31 @@ jQuery.fn.extend({ return jQuery.param(this.serializeArray()); }, serializeArray: function() { - return this.map(function(){ + return this.map(function() { return this.elements ? jQuery.makeArray(this.elements) : this; }) - .filter(function(){ + .filter(function() { return this.name && !this.disabled && (this.checked || rselectTextarea.test(this.nodeName) || rinput.test(this.type)); }) - .map(function(i, elem){ + .map(function( i, elem ) { var val = jQuery(this).val(); return val == null ? null : jQuery.isArray(val) ? - jQuery.map( val, function(val, i){ - return {name: elem.name, value: val}; + jQuery.map( val, function( val, i ) { + return { name: elem.name, value: val }; }) : - {name: elem.name, value: val}; + { name: elem.name, value: val }; }).get(); } }); // Attach a bunch of functions for handling common AJAX events -jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), function(i,o){ - jQuery.fn[o] = function(f){ +jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), function( i, o ) { + jQuery.fn[o] = function( f ) { return this.bind(o, f); }; }); @@ -176,7 +176,7 @@ jQuery.extend({ // Create the request object; Microsoft failed to properly // implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available // This function can be overriden by calling jQuery.ajaxSetup - xhr: function(){ + xhr: function() { return window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest(); @@ -235,13 +235,17 @@ jQuery.extend({ s.dataType = "script"; // Handle JSONP-style loading - window[ jsonp ] = window[ jsonp ] || function(tmp){ + window[ jsonp ] = window[ jsonp ] || function( tmp ) { data = tmp; success(); complete(); // Garbage collect window[ jsonp ] = undefined; - try{ delete window[ jsonp ]; } catch(e){} + + try { + delete window[ jsonp ]; + } catch(e) {} + if ( head ) { head.removeChild( script ); } @@ -291,7 +295,7 @@ jQuery.extend({ var done = false; // Attach handlers for all browsers - script.onload = script.onreadystatechange = function(){ + script.onload = script.onreadystatechange = function() { if ( !done && (!this.readyState || this.readyState === "loaded" || this.readyState === "complete") ) { done = true; @@ -356,7 +360,7 @@ jQuery.extend({ xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ? s.accepts[ s.dataType ] + ", */*" : s.accepts._default ); - } catch(e){} + } catch(e) {} // Allow custom headers/mimetypes and early abort if ( s.beforeSend && s.beforeSend.call(callbackContext, xhr, s) === false ) { @@ -375,7 +379,7 @@ jQuery.extend({ } // Wait for a response to come back - var onreadystatechange = function(isTimeout){ + var onreadystatechange = function( isTimeout ) { // The request was aborted, clear the interval and decrement jQuery.active if ( !xhr || xhr.readyState === 0 ) { if ( ival ) { @@ -447,7 +451,7 @@ jQuery.extend({ // Timeout checker if ( s.timeout > 0 ) { - setTimeout(function(){ + setTimeout(function() { // Check to see if the request is still happening if ( xhr && !requestDone ) { onreadystatechange( "timeout" ); @@ -470,7 +474,7 @@ jQuery.extend({ onreadystatechange(); } - function success(){ + function success() { // If a local callback was specified, fire it and pass it the data if ( s.success ) { s.success.call( callbackContext, data, status, xhr ); @@ -482,7 +486,7 @@ jQuery.extend({ } } - function complete(){ + function complete() { // Process result if ( s.complete ) { s.complete.call( callbackContext, xhr, status); @@ -499,7 +503,7 @@ jQuery.extend({ } } - function trigger(type, args){ + function trigger(type, args) { (s.context ? jQuery(s.context) : jQuery.event).trigger(type, args); } @@ -530,7 +534,7 @@ jQuery.extend({ // Opera returns 0 when status is 304 ( xhr.status >= 200 && xhr.status < 300 ) || xhr.status === 304 || xhr.status === 1223 || xhr.status === 0; - } catch(e){} + } catch(e) {} return false; }, @@ -597,7 +601,7 @@ jQuery.extend({ // Set jQuery.param.traditional to true for jQuery <= 1.3.2 behavior. traditional = jQuery.param.traditional; - function add( key, value ){ + function add( key, value ) { // If value is a function, invoke it and return its value value = jQuery.isFunction(value) ? value() : value; s[ s.length ] = encodeURIComponent(key) + '=' + encodeURIComponent(value); @@ -617,7 +621,7 @@ jQuery.extend({ if ( jQuery.isArray(obj) ) { // Serialize array item. - jQuery.each( obj, function(i,v){ + jQuery.each( obj, function( i, v ) { if ( traditional ) { // Treat each array item as a scalar. add( prefix, v ); @@ -635,7 +639,7 @@ jQuery.extend({ } else if ( !traditional && typeof obj === "object" ) { // Serialize object item. - jQuery.each( obj, function(k,v){ + jQuery.each( obj, function( k, v ) { buildParams( prefix + "[" + k + "]", v ); }); diff --git a/src/attributes.js b/src/attributes.js index e7e5d37..4f5692f 100644 --- a/src/attributes.js +++ b/src/attributes.js @@ -142,7 +142,7 @@ jQuery.fn.extend({ var val = value; - return this.each(function(){ + return this.each(function() { if ( jQuery.isFunction(value) ) { val = value.call(this); @@ -163,7 +163,7 @@ jQuery.fn.extend({ } else if ( jQuery.nodeName( this, "select" ) ) { var values = jQuery.makeArray(val); - jQuery( "option", this ).each(function(){ + jQuery( "option", this ).each(function() { this.selected = jQuery.inArray( this.value || this.text, values ) >= 0; }); @@ -210,10 +210,12 @@ jQuery.each({ this.className = this.className || classNames === false ? "" : jQuery.data( this, "__className__" ) || ""; } } -}, function(name, fn){ - jQuery.fn[ name ] = function(val, state){ +}, function( name, fn ) { + jQuery.fn[ name ] = function( val, state ) { if ( jQuery.isFunction( val ) ) { - return this.each(function() { jQuery(this)[ name ]( val.call(this), state ); }); + return this.each(function() { + jQuery(this)[ name ]( val.call(this), state ); + }); } return this.each( fn, arguments ); diff --git a/src/core.js b/src/core.js index eb67ba1..faba32a 100644 --- a/src/core.js +++ b/src/core.js @@ -164,7 +164,7 @@ jQuery.fn = jQuery.prototype = { return this.length; }, - toArray: function(){ + toArray: function() { return slice.call( this, 0 ); }, @@ -258,7 +258,7 @@ jQuery.fn = jQuery.prototype = { }, map: function( callback ) { - return this.pushStack( jQuery.map(this, function(elem, i){ + return this.pushStack( jQuery.map(this, function( elem, i ) { return callback.call( elem, i, elem ); })); }, @@ -379,7 +379,10 @@ jQuery.extend({ }, bindReady: function() { - if ( readyBound ) { return; } + if ( readyBound ) { + return; + } + readyBound = true; // Catch cases where $(document).ready() is called after the @@ -411,7 +414,7 @@ jQuery.extend({ try { toplevel = window.frameElement == null; - } catch(e){} + } catch(e) {} if ( document.documentElement.doScroll && toplevel ) { doScrollCheck(); diff --git a/src/css.js b/src/css.js index 5b6b7b9..e52e453 100644 --- a/src/css.js +++ b/src/css.js @@ -8,11 +8,15 @@ var rexclude = /z-?index|font-?weight|opacity|zoom|line-?height/i, rnumpx = /^-?\d+(?:px)?$/i, rnum = /^-?\d/, + cssShow = { position: "absolute", visibility: "hidden", display:"block" }, + cssWidth = [ "Left", "Right" ], + cssHeight = [ "Top", "Bottom" ], + // cache check for defaultView.getComputedStyle getComputedStyle = document.defaultView && document.defaultView.getComputedStyle, // normalize float css property styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat", - fcamelCase = function(all, letter){ + fcamelCase = function( all, letter ) { return letter.toUpperCase(); }; @@ -78,12 +82,14 @@ jQuery.extend({ css: function( elem, name, force, extra ) { if ( name === "width" || name === "height" ) { - var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name === "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ]; + var val, props = cssShow, which = name === "width" ? cssWidth : cssHeight; function getWH() { val = name === "width" ? elem.offsetWidth : elem.offsetHeight; - if ( extra === "border" ) { return; } + if ( extra === "border" ) { + return; + } jQuery.each( which, function() { if ( !extra ) { diff --git a/src/data.js b/src/data.js index 69adc12..e3dc190 100644 --- a/src/data.js +++ b/src/data.js @@ -100,7 +100,7 @@ jQuery.extend({ }); jQuery.fn.extend({ - data: function( key, value ){ + data: function( key, value ) { if ( typeof key === "undefined" && this.length ) { return jQuery.data( this[0] ); @@ -123,14 +123,14 @@ jQuery.fn.extend({ this.data( parts[0] ) : data; } else { - return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){ + return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function() { jQuery.data( this, key, value ); }); } }, - removeData: function( key ){ - return this.each(function(){ + removeData: function( key ) { + return this.each(function() { jQuery.removeData( this, key ); }); } diff --git a/src/dimensions.js b/src/dimensions.js index d3c8418..3acbb1d 100644 --- a/src/dimensions.js +++ b/src/dimensions.js @@ -1,17 +1,17 @@ // Create innerHeight, innerWidth, outerHeight and outerWidth methods -jQuery.each([ "Height", "Width" ], function(i, name){ +jQuery.each([ "Height", "Width" ], function( i, name ) { var type = name.toLowerCase(); // innerHeight and innerWidth - jQuery.fn["inner" + name] = function(){ + jQuery.fn["inner" + name] = function() { return this[0] ? jQuery.css( this[0], type, false, "padding" ) : null; }; // outerHeight and outerWidth - jQuery.fn["outer" + name] = function(margin) { + jQuery.fn["outer" + name] = function( margin ) { return this[0] ? jQuery.css( this[0], type, false, margin ? "margin" : "border" ) : null; diff --git a/src/effects.js b/src/effects.js index 5d656c9..ff2f145 100644 --- a/src/effects.js +++ b/src/effects.js @@ -17,7 +17,7 @@ jQuery.fn.extend({ return this.animate( genFx("show", 3), speed, callback); } else { - for ( var i = 0, l = this.length; i < l; i++ ){ + for ( var i = 0, l = this.length; i < l; i++ ) { var old = jQuery.data(this[i], "olddisplay"); this[i].style.display = old || ""; @@ -48,7 +48,7 @@ jQuery.fn.extend({ // Set the display of the elements in a second loop // to avoid the constant reflow - for ( var j = 0, k = this.length; j < k; j++ ){ + for ( var j = 0, k = this.length; j < k; j++ ) { this[j].style.display = jQuery.data(this[j], "olddisplay") || ""; } @@ -61,16 +61,16 @@ jQuery.fn.extend({ return this.animate( genFx("hide", 3), speed, callback); } else { - for ( var i = 0, l = this.length; i < l; i++ ){ + for ( var i = 0, l = this.length; i < l; i++ ) { var old = jQuery.data(this[i], "olddisplay"); - if ( !old && old !== "none" ){ + if ( !old && old !== "none" ) { jQuery.data(this[i], "olddisplay", jQuery.css(this[i], "display")); } } // Set the display of the elements in a second loop // to avoid the constant reflow - for ( var j = 0, k = this.length; j < k; j++ ){ + for ( var j = 0, k = this.length; j < k; j++ ) { this[j].style.display = "none"; } @@ -88,7 +88,7 @@ jQuery.fn.extend({ this._toggle.apply( this, arguments ); } else if ( fn == null || bool ) { - this.each(function(){ + this.each(function() { var state = bool ? fn : jQuery(this).is(":hidden"); jQuery(this)[ state ? "show" : "hide" ](); }); @@ -190,14 +190,14 @@ jQuery.fn.extend({ }); }, - stop: function(clearQueue, gotoEnd){ + stop: function( clearQueue, gotoEnd ) { var timers = jQuery.timers; if ( clearQueue ) { this.queue([]); } - this.each(function(){ + this.each(function() { // go in reverse order so anything added to the queue during the loop is ignored for ( var i = timers.length - 1; i >= 0; i-- ) { if ( timers[i].elem === this ) { @@ -228,8 +228,8 @@ jQuery.each({ slideToggle: genFx("toggle", 1), fadeIn: { opacity: "show" }, fadeOut: { opacity: "hide" } -}, function( name, props ){ - jQuery.fn[ name ] = function( speed, callback ){ +}, function( name, props ) { + jQuery.fn[ name ] = function( speed, callback ) { return this.animate( props, speed, callback ); }; }); @@ -248,7 +248,7 @@ jQuery.extend({ // Queueing opt.old = opt.complete; - opt.complete = function(){ + opt.complete = function() { if ( opt.queue !== false ) { jQuery(this).dequeue(); } @@ -464,8 +464,8 @@ jQuery.extend( jQuery.fx, { }); if ( jQuery.expr && jQuery.expr.filters ) { - jQuery.expr.filters.animated = function(elem){ - return jQuery.grep(jQuery.timers, function(fn){ + jQuery.expr.filters.animated = function( elem ) { + return jQuery.grep(jQuery.timers, function( fn ) { return elem === fn.elem; }).length; }; @@ -474,7 +474,7 @@ if ( jQuery.expr && jQuery.expr.filters ) { function genFx( type, num ) { var obj = {}; - jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function(){ + jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() { obj[ this ] = type; }); diff --git a/src/event.js b/src/event.js index 892525a..3697e4e 100644 --- a/src/event.js +++ b/src/event.js @@ -1,3 +1,9 @@ +var fcleanup = function( nm ) { + return nm.replace(/[^\w\s\.\|`]/g, function( ch ) { + return "\\" + ch; + }); +}; + /* * A number of helper functions used for managing events. * Many of the ideas behind this code originated from @@ -142,7 +148,7 @@ jQuery.event = { var namespaces = type.split("."); type = namespaces.shift(); var all = !namespaces.length, - cleaned = jQuery.map( namespaces.slice(0).sort() , function(nm){ return nm.replace(/[^\w\s\.\|`]/g, function(ch){return "\\"+ch; }); }), + cleaned = jQuery.map( namespaces.slice(0).sort(), fcleanup ), namespace = new RegExp("(^|\\.)" + cleaned.join("\\.(?:.*\\.)?") + "(\\.|$)"), special = this.special[ type ] || {}; @@ -403,10 +409,15 @@ jQuery.event = { thisObject = proxy; proxy = undefined; } + // FIXME: Should proxy be redefined to be applied with thisObject if defined? - proxy = proxy || function() { return fn.apply( thisObject !== undefined ? thisObject : this, arguments ); }; + proxy = proxy || function() { + return fn.apply( thisObject !== undefined ? thisObject : this, arguments ); + }; + // Set the guid of unique handler to the same of original handler, so it can be removed proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++; + // So proxy can be declared as an argument return proxy; }, @@ -462,7 +473,7 @@ jQuery.event = { } }; -jQuery.Event = function( src ){ +jQuery.Event = function( src ) { // Allow instantiation without the 'new' keyword if ( !this.preventDefault ) { return new jQuery.Event( src ); @@ -524,7 +535,7 @@ jQuery.Event.prototype = { // otherwise set the cancelBubble property of the original event to true (IE) e.cancelBubble = true; }, - stopImmediatePropagation: function(){ + stopImmediatePropagation: function() { this.isImmediatePropagationStopped = returnTrue; this.stopPropagation(); }, @@ -575,10 +586,10 @@ jQuery.each({ mouseleave: "mouseout" }, function( orig, fix ) { jQuery.event.special[ orig ] = { - setup: function(data){ + setup: function( data ) { jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig ); }, - teardown: function(data){ + teardown: function( data ) { jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement ); } }; @@ -728,7 +739,7 @@ function trigger( type, elem, args ) { // Create "bubbling" focus and blur events if ( document.addEventListener ) { - jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ){ + jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { jQuery.event.special[ fix ] = { setup: function() { this.addEventListener( orig, handler, true ); @@ -746,7 +757,7 @@ if ( document.addEventListener ) { }); } -jQuery.each(["bind", "one"], function(i, name) { +jQuery.each(["bind", "one"], function( i, name ) { jQuery.fn[ name ] = function( type, data, fn, thisObject ) { // Handle object literals if ( typeof type === "object" ) { @@ -807,7 +818,7 @@ jQuery.fn.extend({ var args = arguments, i = 1; // link all the functions, so any of them can unbind this click handler - while( i < args.length ) { + while ( i < args.length ) { jQuery.event.proxy( fn, args[ i++ ] ); } diff --git a/src/intro.js b/src/intro.js index adea1b5..19a2c80 100644 --- a/src/intro.js +++ b/src/intro.js @@ -13,5 +13,5 @@ * * Date: */ -(function(window, undefined){ +(function( window, undefined ) { diff --git a/src/manipulation.js b/src/manipulation.js index 4f7ee65..7500730 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -5,8 +5,8 @@ var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, rtagName = /<([\w:]+)/, rtbody = /"; }, @@ -32,7 +32,7 @@ if ( !jQuery.support.htmlSerialize ) { jQuery.fn.extend({ text: function( text ) { - if(jQuery.isFunction(text)) { + if ( jQuery.isFunction(text) ) { return this.each(function() { return jQuery(this).text( text.call(this) ); }); @@ -60,7 +60,7 @@ jQuery.fn.extend({ wrap.insertBefore( this[0] ); } - wrap.map(function(){ + wrap.map(function() { var elem = this; while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { @@ -75,19 +75,19 @@ jQuery.fn.extend({ }, wrapInner: function( html ) { - return this.each(function(){ + return this.each(function() { jQuery( this ).contents().wrapAll( html ); }); }, wrap: function( html ) { - return this.each(function(){ + return this.each(function() { jQuery( this ).wrapAll( html ); }); }, unwrap: function() { - return this.parent().each(function(){ + return this.parent().each(function() { if ( !jQuery.nodeName( this, "body" ) ) { jQuery( this ).replaceWith( this.childNodes ); } @@ -95,7 +95,7 @@ jQuery.fn.extend({ }, append: function() { - return this.domManip(arguments, true, function(elem){ + return this.domManip(arguments, true, function( elem ) { if ( this.nodeType === 1 ) { this.appendChild( elem ); } @@ -103,7 +103,7 @@ jQuery.fn.extend({ }, prepend: function() { - return this.domManip(arguments, true, function(elem){ + return this.domManip(arguments, true, function( elem ) { if ( this.nodeType === 1 ) { this.insertBefore( elem, this.firstChild ); } @@ -112,7 +112,7 @@ jQuery.fn.extend({ before: function() { if ( this[0] && this[0].parentNode ) { - return this.domManip(arguments, false, function(elem){ + return this.domManip(arguments, false, function( elem ) { this.parentNode.insertBefore( elem, this ); }); } else if ( arguments.length ) { @@ -124,7 +124,7 @@ jQuery.fn.extend({ after: function() { if ( this[0] && this[0].parentNode ) { - return this.domManip(arguments, false, function(elem){ + return this.domManip(arguments, false, function( elem ) { this.parentNode.insertBefore( elem, this.nextSibling ); }); } else if ( arguments.length ) { @@ -136,7 +136,7 @@ jQuery.fn.extend({ clone: function( events ) { // Do the clone - var ret = this.map(function(){ + var ret = this.map(function() { if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) { // IE copies events bound via attachEvent when // using cloneNode. Calling detachEvent on the @@ -204,7 +204,7 @@ jQuery.fn.extend({ replaceWith: function( value ) { if ( this[0] && this[0].parentNode ) { - return this.each(function(){ + return this.each(function() { var next = this.nextSibling, parent = this.parentNode; jQuery(this).remove(); @@ -278,7 +278,7 @@ jQuery.fn.extend({ function cloneCopyEvent(orig, ret) { var i = 0; - ret.each(function(){ + ret.each(function() { if ( this.nodeName !== (orig[i] && orig[i].nodeName) ) { return; } @@ -287,7 +287,7 @@ function cloneCopyEvent(orig, ret) { }); } -function buildFragment(args, nodes, scripts){ +function buildFragment( args, nodes, scripts ) { var fragment, cacheable, cached, cacheresults, doc; if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && args[0].indexOf("= 0) === keep; }); }; @@ -114,7 +114,7 @@ jQuery.fn.extend({ var pos = jQuery.expr.match.POS.test( selectors ) ? jQuery( selectors, context || this.context ) : null; - return this.map(function(i, cur){ + return this.map(function( i, cur ) { while ( cur && cur.ownerDocument && cur !== context ) { if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selectors) ) { return cur; @@ -157,19 +157,46 @@ jQuery.fn.extend({ }); jQuery.each({ - parent: function(elem){var parent = elem.parentNode; return parent && parent.nodeType !== 11 ? parent : null;}, - parents: function(elem){return jQuery.dir(elem,"parentNode");}, - parentsUntil: function(elem,i,until){return jQuery.dir(elem,"parentNode",until);}, - next: function(elem){return jQuery.nth(elem,2,"nextSibling");}, - prev: function(elem){return jQuery.nth(elem,2,"previousSibling");}, - nextAll: function(elem){return jQuery.dir(elem,"nextSibling");}, - prevAll: function(elem){return jQuery.dir(elem,"previousSibling");}, - nextUntil: function(elem,i,until){return jQuery.dir(elem,"nextSibling",until);}, - prevUntil: function(elem,i,until){return jQuery.dir(elem,"previousSibling",until);}, - siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);}, - children: function(elem){return jQuery.sibling(elem.firstChild);}, - contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);} -}, function(name, fn){ + parent: function( elem ) { + var parent = elem.parentNode; + return parent && parent.nodeType !== 11 ? parent : null; + }, + parents: function( elem ) { + return jQuery.dir( elem, "parentNode" ); + }, + parentsUntil: function( elem, i, until ) { + return jQuery.dir( elem, "parentNode", until ); + }, + next: function( elem ) { + return jQuery.nth( elem, 2, "nextSibling" ); + }, + prev: function( elem ) { + return jQuery.nth( elem, 2, "previousSibling" ); + }, + nextAll: function( elem ) { + return jQuery.dir( elem, "nextSibling" ); + }, + prevAll: function( elem ) { + return jQuery.dir( elem, "previousSibling" ); + }, + nextUntil: function( elem, i, until ) { + return jQuery.dir( elem, "nextSibling", until ); + }, + prevUntil: function( elem, i, until ) { + return jQuery.dir( elem, "previousSibling", until ); + }, + siblings: function( elem ) { + return jQuery.sibling( elem.parentNode.firstChild, elem ); + }, + children: function( elem ) { + return jQuery.sibling( elem.firstChild ); + }, + contents: function( elem ) { + return jQuery.nodeName( elem, "iframe" ) ? + elem.contentDocument || elem.contentWindow.document : + jQuery.makeArray( elem.childNodes ); + } +}, function( name, fn ) { jQuery.fn[ name ] = function( until, selector ) { var ret = jQuery.map( this, fn, until ); -- 1.7.10.4