Got context functions back in, added noteworthy stuff, replaced js linebreak replacer...
authorJörn Zaefferer <joern.zaefferer@gmail.com>
Tue, 12 Dec 2006 20:33:10 +0000 (20:33 +0000)
committerJörn Zaefferer <joern.zaefferer@gmail.com>
Tue, 12 Dec 2006 20:33:10 +0000 (20:33 +0000)
build/docs/js/doc.js
build/docs/style/docs.xsl
newandnoteworthy.txt
src/jquery/jquery.js

index dcf42a5..8a144f0 100644 (file)
@@ -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;
        });
        
index 8d9f670..ff1977a 100644 (file)
@@ -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'>
 </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>
index 11650d9..5f35efc 100644 (file)
@@ -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)
\ No newline at end of file
+ - 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)
\ No newline at end of file
index 9e62fe3..177d86b 100644 (file)
@@ -22,7 +22,7 @@ window.undefined = window.undefined;
  */\r
 var jQuery = function(a,c) {\r
 \r
-       // Shortcut for document ready (because $(document).each() is silly)\r
+       // Shortcut for document ready\r
        if ( a && typeof a == "function" && jQuery.fn.ready && !a.nodeType && a[0] == undefined ) // Safari reports typeof on DOM NodeLists as a function\r
                return jQuery(document).ready(a);\r
 \r
@@ -55,6 +55,13 @@ var jQuery = function(a,c) {
                // Find the matching elements and save them for later\r
                jQuery.find( a, c ) );\r
 \r
+       // See if an extra function was provided\r
+       var fn = arguments[ arguments.length - 1 ];\r
+\r
+       // If so, execute it in context\r
+       if ( fn && typeof fn == "function" )\r
+               this.each(fn);\r
+\r
        return this;\r
 };\r
 \r
@@ -789,7 +796,7 @@ jQuery.fn = jQuery.prototype = {
        find: function(t) {\r
                return this.pushStack( jQuery.map( this, function(a){\r
                        return jQuery.find(t,a);\r
-               }));\r
+               }), arguments );\r
        },\r
 \r
        /**\r
@@ -810,7 +817,7 @@ jQuery.fn = jQuery.prototype = {
        clone: function(deep) {\r
                return this.pushStack( jQuery.map( this, function(a){\r
                        return a.cloneNode( deep != undefined ? deep : true );\r
-               }));\r
+               }), arguments );\r
        },\r
 \r
        /**\r
@@ -865,7 +872,7 @@ jQuery.fn = jQuery.prototype = {
                        typeof t == "function" &&\r
                        jQuery.grep( this, t ) ||\r
 \r
-                       jQuery.filter(t,this).r );\r
+                       jQuery.filter(t,this).r, arguments );\r
        },\r
 \r
        /**\r
@@ -899,7 +906,7 @@ jQuery.fn = jQuery.prototype = {
        not: function(t) {\r
                return this.pushStack( typeof t == "string" ?\r
                        jQuery.filter(t,this,false).r :\r
-                       jQuery.grep(this,function(a){ return a != t; }) );\r
+                       jQuery.grep(this,function(a){ return a != t; }), arguments );\r
        },\r
 \r
        /**\r
@@ -945,7 +952,7 @@ jQuery.fn = jQuery.prototype = {
         */\r
        add: function(t) {\r
                return this.pushStack( jQuery.merge( this, typeof t == "string" ?\r
-                       jQuery.find(t) : t.constructor == Array ? t : [t] ) );\r
+                       jQuery.find(t) : t.constructor == Array ? t : [t] ), arguments );\r
        },\r
 \r
        /**\r
@@ -1021,11 +1028,28 @@ jQuery.fn = jQuery.prototype = {
         * @type jQuery\r
         * @cat Core\r
         */\r
-       pushStack: function(a) {\r
-               if ( !this.stack )\r
-                       this.stack = [];\r
-               this.stack.push( this.get() );\r
-               return this.set( a );\r
+       pushStack: function(a,args) {\r
+               var fn = args && args[args.length-1];\r
+               var fn2 = args && args[args.length-2];\r
+               \r
+               if ( fn && fn.constructor != Function ) fn = null;\r
+               if ( fn2 && fn2.constructor != Function ) fn2 = null;\r
+\r
+               if ( !fn ) {\r
+                       if ( !this.stack ) this.stack = [];\r
+                       this.stack.push( this.get() );\r
+                       this.set( a );\r
+               } else {\r
+                       var old = this.get();\r
+                       this.set( a );\r
+\r
+                       if ( fn2 && a.length || !fn2 )\r
+                               this.each( fn2 || fn ).set( old );\r
+                       else\r
+                               this.set( old ).each( fn );\r
+               }\r
+\r
+               return this;\r
        }\r
 };\r
 \r
@@ -1992,6 +2016,11 @@ jQuery.extend({
  * This property is available before the DOM is ready, therefore you can\r
  * use it to add ready events only for certain browsers.\r
  *\r
+ * There are situations where object detections is not reliable enough, in that\r
+ * cases it makes sense to use browser detection. Simply try to avoid both!\r
+ *\r
+ * A combination of browser and object detection yields quite reliable results.\r
+ *\r
  * @example $.browser.msie\r
  * @desc Returns true if the current useragent is some version of microsoft's internet explorer\r
  *\r