Skip to content

Commit

Permalink
Got context functions back in, added noteworthy stuff, replaced js li…
Browse files Browse the repository at this point in the history
…nebreak replacer with xstl
  • Loading branch information
jzaefferer committed Dec 12, 2006
1 parent fb11b33 commit 6ac46e6
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 18 deletions.
6 changes: 1 addition & 5 deletions build/docs/js/doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ $(document).ready(function(){
}).ToolTipDemo('#fff');

$("a.name").click(function(){
$("div.more,div.short",this.parentNode.parentNode)
.find("div.desc").each(function(){
$(this).html( $(this).html().replace(/\n\n/g, "<br/><br/>") );
}).end()
.toggle('slow');
$("div.more,div.short",this.parentNode.parentNode).toggle('slow');
return false;
});

Expand Down
20 changes: 19 additions & 1 deletion build/docs/style/docs.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
</div>
<div class='more'>
<div class='desc'>
<xsl:value-of select="desc"/>
<xsl:for-each select="desc">
<xsl:call-template name="break" />
</xsl:for-each>
</div>
<xsl:for-each select="examples">
<div class='example'>
Expand Down Expand Up @@ -66,4 +68,20 @@
</html>
</xsl:template>

<xsl:template name="break">
<xsl:param name="text" select="." />
<xsl:choose>
<xsl:when test="contains($text, '&#xa;&#xa;')">
<xsl:value-of select="substring-before($text, '&#xa;&#xa;')" />
<br /><br />
<xsl:call-template name="break">
<xsl:with-param name="text" select="substring-after($text, '&#xa;&#xa;')" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>

</xsl:stylesheet>
7 changes: 6 additions & 1 deletion newandnoteworthy.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@ New and Noteworthy
- Extensions to global ajax handlers: ajaxSend, ajaxSuccess, ajaxError and ajaxComplete get XMLHttpRequest and settings passed as arguments
- Extensions to event handling: pageX and pageY are available x-browser (IE does not provide native pageX/Y)
- Improved docs: $(String) method has now two seperate descriptions, one for selecting elements, one for creating (html on-the-fly)
- FX module: Most inline stlyes added by animations are now removed when the animation is complete, eg. height style when animating height (exception: display styles)
- FX module: Most inline stlyes added by animations are now removed when the animation is complete, eg. height style when animating height (exception: display styles)
- Added note to attr(String, Object) about issues with setting the name property on input elements
- Seperated internal stuff from get() into set()
- Merged the two API examples for each() into one more precise example
- Improved docs for $.browser and added docs for $.boxModel
- Docs for the jQuery constructor $() were improved: There is now $(String expression[, Object context]) and $(String html)
51 changes: 40 additions & 11 deletions src/jquery/jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ window.undefined = window.undefined;
*/
var jQuery = function(a,c) {

// Shortcut for document ready (because $(document).each() is silly)
// Shortcut for document ready
if ( a && typeof a == "function" && jQuery.fn.ready && !a.nodeType && a[0] == undefined ) // Safari reports typeof on DOM NodeLists as a function
return jQuery(document).ready(a);

Expand Down Expand Up @@ -55,6 +55,13 @@ var jQuery = function(a,c) {
// Find the matching elements and save them for later
jQuery.find( a, c ) );

// See if an extra function was provided
var fn = arguments[ arguments.length - 1 ];

// If so, execute it in context
if ( fn && typeof fn == "function" )
this.each(fn);

return this;
};

Expand Down Expand Up @@ -789,7 +796,7 @@ jQuery.fn = jQuery.prototype = {
find: function(t) {
return this.pushStack( jQuery.map( this, function(a){
return jQuery.find(t,a);
}));
}), arguments );
},

/**
Expand All @@ -810,7 +817,7 @@ jQuery.fn = jQuery.prototype = {
clone: function(deep) {
return this.pushStack( jQuery.map( this, function(a){
return a.cloneNode( deep != undefined ? deep : true );
}));
}), arguments );
},

/**
Expand Down Expand Up @@ -865,7 +872,7 @@ jQuery.fn = jQuery.prototype = {
typeof t == "function" &&
jQuery.grep( this, t ) ||

jQuery.filter(t,this).r );
jQuery.filter(t,this).r, arguments );
},

/**
Expand Down Expand Up @@ -899,7 +906,7 @@ jQuery.fn = jQuery.prototype = {
not: function(t) {
return this.pushStack( typeof t == "string" ?
jQuery.filter(t,this,false).r :
jQuery.grep(this,function(a){ return a != t; }) );
jQuery.grep(this,function(a){ return a != t; }), arguments );
},

/**
Expand Down Expand Up @@ -945,7 +952,7 @@ jQuery.fn = jQuery.prototype = {
*/
add: function(t) {
return this.pushStack( jQuery.merge( this, typeof t == "string" ?
jQuery.find(t) : t.constructor == Array ? t : [t] ) );
jQuery.find(t) : t.constructor == Array ? t : [t] ), arguments );
},

/**
Expand Down Expand Up @@ -1021,11 +1028,28 @@ jQuery.fn = jQuery.prototype = {
* @type jQuery
* @cat Core
*/
pushStack: function(a) {
if ( !this.stack )
this.stack = [];
this.stack.push( this.get() );
return this.set( a );
pushStack: function(a,args) {
var fn = args && args[args.length-1];
var fn2 = args && args[args.length-2];

if ( fn && fn.constructor != Function ) fn = null;
if ( fn2 && fn2.constructor != Function ) fn2 = null;

if ( !fn ) {
if ( !this.stack ) this.stack = [];
this.stack.push( this.get() );
this.set( a );
} else {
var old = this.get();
this.set( a );

if ( fn2 && a.length || !fn2 )
this.each( fn2 || fn ).set( old );
else
this.set( old ).each( fn );
}

return this;
}
};

Expand Down Expand Up @@ -1992,6 +2016,11 @@ jQuery.extend({
* This property is available before the DOM is ready, therefore you can
* use it to add ready events only for certain browsers.
*
* There are situations where object detections is not reliable enough, in that
* cases it makes sense to use browser detection. Simply try to avoid both!
*
* A combination of browser and object detection yields quite reliable results.
*
* @example $.browser.msie
* @desc Returns true if the current useragent is some version of microsoft's internet explorer
*
Expand Down

0 comments on commit 6ac46e6

Please sign in to comment.