X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fjquery%2Fjquery.js;h=3edc3033354fa27c408a18c71bb12f13c9c364db;hb=eff56887b164b489bb792f87770b7ba69e8f54df;hp=65732b8f7a0b9d7ccfa5e41d84cff7510081840d;hpb=97ea47492fe13ddb1108045c244d5af6570ace92;p=jquery.git diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index 65732b8..3edc303 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -127,9 +127,8 @@ if ( typeof $ != "undefined" ) * @before
one
two
three
* @result [two
] * - * @example $(document).ready( loaded ); - * @desc Executes the "loaded" function when the DOM is ready to - * be manipulated. + * @example $(document.body).background( "black" ); + * @desc Sets the background color of the page to black. * * @name $ * @param Element elem A DOM element to be encapsulated by a jQuery object. @@ -151,10 +150,15 @@ if ( typeof $ != "undefined" ) /** * A shorthand for $(document).ready(), allowing you to bind a function - * to be executed when the DOM document has finished loading. + * to be executed when the DOM document has finished loading. This function + * behaves just like $(document).ready(), in that it should be used to wrap + * all of the other $() operations on your page. While this function is, + * technically, chainable - there really isn't much use for chaining against it. * - * @example $( loaded ) - * @desc Executes the function "loaded" when the DOM is ready to be used. + * @example $(function(){ + * // Document is ready + * }); + * @desc Executes the function when the DOM is ready to be used. * * @name $ * @param Function fn The function to execute when the DOM is ready. @@ -163,11 +167,13 @@ if ( typeof $ != "undefined" ) */ /** - * A means of creating a duplicate copy of a jQuery object. + * A means of creating a cloned copy of a jQuery object. This function + * copies the set of matched elements from one jQuery object and creates + * another, new, jQuery object containing the same elements. * * @example var div = $("div"); - * $( div ).find("p") - * @desc Locates all p elements with all div elements, without disrupting the original jQuery object contained in 'div'. + * $( div ).find("p"); + * @desc Locates all p elements with all div elements, without disrupting the original jQuery object contained in 'div' (as would normally be the case if a simple div.find("p") was done). * * @name $ * @param jQuery obj The jQuery object to be cloned. @@ -343,14 +349,14 @@ jQuery.fn = jQuery.prototype = { * @result -1 * * @test ok( $([window, document]).index(window) == 0, "Check for index of elements" ); - * ok( $([window, document]).index(document) == 1, "Check for index of elements" ); - * var inputElements = $('#radio1,#radio2,#check1,#check2'); - * ok( inputElements.index(document.getElementById('radio1')) == 0, "Check for index of elements" ); - * ok( inputElements.index(document.getElementById('radio2')) == 1, "Check for index of elements" ); - * ok( inputElements.index(document.getElementById('check1')) == 2, "Check for index of elements" ); - * ok( inputElements.index(document.getElementById('check2')) == 3, "Check for index of elements" ); - * ok( inputElements.index(window) == -1, "Check for not found index" ); - * ok( inputElements.index(document) == -1, "Check for not found index" ); + * @test ok( $([window, document]).index(document) == 1, "Check for index of elements" ); + * @test var inputElements = $('#radio1,#radio2,#check1,#check2'); + * @test ok( inputElements.index(document.getElementById('radio1')) == 0, "Check for index of elements" ); + * @test ok( inputElements.index(document.getElementById('radio2')) == 1, "Check for index of elements" ); + * @test ok( inputElements.index(document.getElementById('check1')) == 2, "Check for index of elements" ); + * @test ok( inputElements.index(document.getElementById('check2')) == 3, "Check for index of elements" ); + * @test ok( inputElements.index(window) == -1, "Check for not found index" ); + * @test ok( inputElements.index(document) == -1, "Check for not found index" ); * * @name index * @type Number @@ -460,6 +466,17 @@ jQuery.fn = jQuery.prototype = { * @example $("p").css("color"); * @beforeTest Paragraph.
* @result red + * @desc Retrieves the color style of the first paragraph + * + * @example $("p").css("fontWeight"); + * @beforeTest Paragraph.
+ * @result bold + * @desc Retrieves the font-weight style of the first paragraph. + * Note that for all style properties with a dash (like 'font-weight'), you have to + * write it in camelCase. In other words: Every time you have a '-' in a + * property, remove it and replace the next character with an uppercase + * representation of itself. Eg. fontWeight, fontSize, fontFamily, borderWidth, + * borderStyle, borderBottomWidth etc. * * @test ok( $('#foo').css("display") == 'block', 'Check for css property "display"'); * @@ -479,9 +496,9 @@ jQuery.fn = jQuery.prototype = { * @resultTest Paragraph.
* * @test ok( $('#foo').is(':visible'), 'Modifying CSS display: Assert element is visible'); - * $('#foo').css({display: 'none'}); + * @test $('#foo').css({display: 'none'}); * ok( !$('#foo').is(':visible'), 'Modified CSS display: Assert element is hidden'); - * $('#foo').css({display: 'block'}); + * @test $('#foo').css({display: 'block'}); * ok( $('#foo').is(':visible'), 'Modified CSS display: Assert element is visible'); * * @name css @@ -496,11 +513,13 @@ jQuery.fn = jQuery.prototype = { * @example $("p").css("color","red"); * @beforeTest Paragraph.
* @resultTest Paragraph.
+ * @desc Changes the color of all paragraphs to red + * * * @test ok( $('#foo').is(':visible'), 'Modifying CSS display: Assert element is visible'); - * $('#foo').css('display', 'none'); + * @test $('#foo').css('display', 'none'); * ok( !$('#foo').is(':visible'), 'Modified CSS display: Assert element is hidden'); - * $('#foo').css('display', 'block'); + * @test $('#foo').css('display', 'block'); * ok( $('#foo').is(':visible'), 'Modified CSS display: Assert element is visible'); * * @name css @@ -556,6 +575,11 @@ jQuery.fn = jQuery.prototype = { * @example $("p").wrap(""); * @beforeTest Paragraph.
* @resultTest Paragraph.