From d7b47384094613889d890df6ea89d5031236a21d Mon Sep 17 00:00:00 2001 From: Marnus Weststrate Date: Sun, 16 Oct 2011 09:24:11 +0200 Subject: [PATCH 1/8] $.Vector: Fixed x() and y() description which was the wrong way around. --- lang/vector/vector.js | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/lang/vector/vector.js b/lang/vector/vector.js index 5bbf46f2..a1cc1501 100644 --- a/lang/vector/vector.js +++ b/lang/vector/vector.js @@ -77,28 +77,36 @@ steal('jquery').then(function($){ } return vec.update(arr); }, -/* - * Returns the 2nd value of the vector - * @return {Number} - */ + /** + * Returns the first value of the vector + * @return {Number} + */ x: getSetZero, - width: getSetZero, + /** + * same as x() + * @return {Number} + */ + left: getSetZero, /** * Returns the first value of the vector * @return {Number} */ + width: getSetZero, + /** + * Returns the 2nd value of the vector + * @return {Number} + */ y: getSetOne, - height: getSetOne, /** - * Same as x() + * Same as y() * @return {Number} */ top: getSetOne, /** - * same as y() + * Returns the 2nd value of the vector * @return {Number} */ - left: getSetZero, + height: getSetOne, /** * returns (x,y) * @return {String} From 916ac91336d458c787bcba5df16b9aa1e581d482 Mon Sep 17 00:00:00 2001 From: Marnus Weststrate Date: Sun, 16 Oct 2011 10:27:18 +0200 Subject: [PATCH 2/8] Fixed [validation] links which were missing route info and thus not displaying as links. --- model/validations/validations.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/model/validations/validations.js b/model/validations/validations.js index 281544fa..92291a53 100644 --- a/model/validations/validations.js +++ b/model/validations/validations.js @@ -68,7 +68,7 @@ $.extend($.Model, { /** * @function jQuery.Model.static.validate * @parent jquery.model.validations - * Validates each of the specified attributes with the given function. See [validation] for more on validations. + * Validates each of the specified attributes with the given function. See [jquery.model.validations validation] for more on validations. * @param {Array|String} attrNames Attribute name(s) to to validate * @param {Function} validateProc Function used to validate each given attribute. Returns nothing if valid and an error message otherwise. Function is called in the instance context and takes the value to validate. * @param {Object} options (optional) Options for the validations. Valid options include 'message' and 'testIf'. @@ -91,8 +91,8 @@ $.extend($.Model, { * * presence - "can't be empty" * * range - "is out of range" * - * It is important to ensure that you steal jquery/model/validations - * before overwriting the messages, otherwise the changes will + * It is important to steal jquery/model/validations before + * overwriting the messages, otherwise the changes will * be lost once steal loads it later. * * ## Example @@ -112,7 +112,7 @@ $.extend($.Model, { * @function jQuery.Model.static.validateFormatOf * @parent jquery.model.validations * Validates where the values of specified attributes are of the correct form by - * matching it against the regular expression provided. See [validation] for more on validations. + * matching it against the regular expression provided. See [jquery.model.validations validation] for more on validations. * @param {Array|String} attrNames Attribute name(s) to to validate * @param {RegExp} regexp Regular expression used to match for validation * @param {Object} options (optional) Options for the validations. Valid options include 'message' and 'testIf'. @@ -132,7 +132,7 @@ $.extend($.Model, { * @function jQuery.Model.static.validateInclusionOf * @parent jquery.model.validations * Validates whether the values of the specified attributes are available in a particular - * array. See [validation] for more on validations. + * array. See [jquery.model.validations validation] for more on validations. * @param {Array|String} attrNames Attribute name(s) to to validate * @param {Array} inArray Array of options to test for inclusion * @param {Object} options (optional) Options for the validations. Valid options include 'message' and 'testIf'. @@ -151,7 +151,7 @@ $.extend($.Model, { /** * @function jQuery.Model.static.validateLengthOf * @parent jquery.model.validations - * Validates that the specified attributes' lengths are in the given range. See [validation] for more on validations. + * Validates that the specified attributes' lengths are in the given range. See [jquery.model.validations validation] for more on validations. * @param {Array|String} attrNames Attribute name(s) to to validate * @param {Number} min Minimum length (inclusive) * @param {Number} max Maximum length (inclusive) @@ -170,7 +170,7 @@ $.extend($.Model, { /** * @function jQuery.Model.static.validatePresenceOf * @parent jquery.model.validations - * Validates that the specified attributes are not blank. See [validation] for more on validations. + * Validates that the specified attributes are not blank. See [jquery.model.validations validation] for more on validations. * @param {Array|String} attrNames Attribute name(s) to to validate * @param {Object} options (optional) Options for the validations. Valid options include 'message' and 'testIf'. * @@ -185,7 +185,7 @@ $.extend($.Model, { /** * @function jQuery.Model.static.validateRangeOf * @parent jquery.model.validations - * Validates that the specified attributes are in the given numeric range. See [validation] for more on validations. + * Validates that the specified attributes are in the given numeric range. See [jquery.model.validations validation] for more on validations. * @param {Array|String} attrNames Attribute name(s) to to validate * @param {Number} low Minimum value (inclusive) * @param {Number} hi Maximum value (inclusive) From 45e2ecc31e350bead314a03121a3def0dd872a93 Mon Sep 17 00:00:00 2001 From: Marnus Weststrate Date: Sun, 16 Oct 2011 10:28:44 +0200 Subject: [PATCH 3/8] Spelling mistake in dom_selection. --- dom/selection/selection.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom/selection/selection.js b/dom/selection/selection.js index 40d78ce6..45cc2280 100644 --- a/dom/selection/selection.js +++ b/dom/selection/selection.js @@ -195,7 +195,7 @@ getCharElement = function( elems , range, len ) { * returns an object with: * * - __start__ - The number of characters from the start of the element to the start of the selection. - * - __end__ - The number of characters from teh start of the element to the end of the selection. + * - __end__ - The number of characters from the start of the element to the end of the selection. * - __range__ - A [jQuery.Range $.Range] that represents the current selection. * * This lets you get the selected text in a textarea like: From 32255a72a903b032f02a587dc4631ea942d3f830 Mon Sep 17 00:00:00 2001 From: Marnus Weststrate Date: Wed, 19 Oct 2011 15:57:07 +0200 Subject: [PATCH 4/8] Added a note to $.Model.attributes docs to clarify that a full model name type should get an additional '.model' postfix. --- model/model.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/model/model.js b/model/model.js index 22b3e62e..62be6fd0 100644 --- a/model/model.js +++ b/model/model.js @@ -835,6 +835,11 @@ steal('jquery/class', 'jquery/lang/string', function() { * Task.models and Person.model * to convert the raw data into an array of Tasks and a Person. * + * Note that the full names of the models themselves are App.Models.Task + * and App.Models.Person. The _.model_ and _.models_ parts are appended + * for the benefit of [jQuery.Model.static.convert convert] to identify the types as + * models. + * * @demo jquery/model/pages/associations.html * */ From bd46347780f42e1213a7be65cba73bee1eda4d9b Mon Sep 17 00:00:00 2001 From: Marnus Weststrate Date: Tue, 25 Oct 2011 13:28:08 +0200 Subject: [PATCH 5/8] Fixed and added @return to $.route.current() docs. --- dom/route/route.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dom/route/route.js b/dom/route/route.js index ef70387f..73e4a1a7 100644 --- a/dom/route/route.js +++ b/dom/route/route.js @@ -390,8 +390,9 @@ function( $ ) { }, props)) + ">" + name + ""; }, /** - * Returns if the options represent the current page. + * Returns true if the options represent the current page. * @param {Object} options + * @return {Boolean} */ current: function( options ) { return location.hash == "#!" + $route.param(options) From 4dd7a1438ddfdefad026c0bdb5fc182f53809260 Mon Sep 17 00:00:00 2001 From: Marnus Weststrate Date: Wed, 26 Oct 2011 10:24:26 +0200 Subject: [PATCH 6/8] Fixed Model.List.get() and .remove() function docs. --- model/list/list.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/model/list/list.js b/model/list/list.js index ed694d63..f924c02c 100644 --- a/model/list/list.js +++ b/model/list/list.js @@ -447,7 +447,8 @@ steal('jquery/model').then(function( $ ) { * * var match = list.get($('#content')[0]) * - * @param {Object} args element or id to remove + * @param {Object} args elements or ids to retrieve. + * @return {$.Model.List} A sub-Model.List with the elements that were queried. */ get: function() { if (!this.length ) { @@ -478,13 +479,14 @@ steal('jquery/model').then(function( $ ) { * * To remove by id: * - * var match = list.get(23); + * var match = list.remove(23); * * or to remove by element: * - * var match = list.get($('#content')[0]) + * var match = list.remove($('#content')[0]) * - * @param {Object} args element or id to remove + * @param {Object} args elements or ids to remove. + * @return {$.Model.List} A Model.List of the elements that were removed. */ remove: function( args ) { if (!this.length ) { From 88780b3ddb3ce0e19ebb7558c1028e4e1fbbf76f Mon Sep 17 00:00:00 2001 From: Marnus Weststrate Date: Wed, 26 Oct 2011 13:14:59 +0200 Subject: [PATCH 7/8] Some more clean-up and docs for Model.List. --- model/list/list.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/model/list/list.js b/model/list/list.js index f924c02c..064bf5bd 100644 --- a/model/list/list.js +++ b/model/list/list.js @@ -5,8 +5,7 @@ steal('jquery/model').then(function( $ ) { return args[0] } else if ( args[0] instanceof $.Model.List ) { return $.makeArray(args[0]) - } - else { + } else { return $.makeArray(args) } }, @@ -466,8 +465,10 @@ steal('jquery/model').then(function( $ ) { for ( var i = 0; i < args.length; i++ ) { if ( args[i].nodeName && (matches = args[i].className.match(test)) ) { + // If this is a dom element val = this._data[matches[1]] } else { + // Else an id was provided as a number or string. val = this._data[typeof args[i] == 'string' || typeof args[i] == 'number' ? args[i] : args[i][idName]] } val && list.push(val) @@ -693,13 +694,15 @@ steal('jquery/model').then(function( $ ) { }, /** * @function push - * Adds a instance or instances to the list + * Adds an instance or instances to the list * * list.push(new Recipe({id: 5, name: "Water"})) + * + * @param args {Object} The instance(s) to push onto the list. + * @return {Number} The number of elements in the list after the new element was pushed in. */ push: function() { - var args = getArgs(arguments), - self = this; + var args = getArgs(arguments); //listen to events on this only if someone is listening on us, this means remove won't //be called if we aren't listening for removes if ( this[expando] !== undefined ) { From 339590ee7491aa4635050359bc0437cce3c10d02 Mon Sep 17 00:00:00 2001 From: Marnus Weststrate Date: Wed, 2 Nov 2011 11:04:54 +0200 Subject: [PATCH 8/8] Docs fix: getobject -> getObject. --- lang/string/string.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/string/string.js b/lang/string/string.js index e4adc98b..99ff23e9 100644 --- a/lang/string/string.js +++ b/lang/string/string.js @@ -89,7 +89,7 @@ steal('jquery').then(function( $ ) { * 'object path' by removing or adding properties. * * Foo = {Bar: {Zar: {"Ted"}}} - * $.String.getobject("Foo.Bar.Zar") //-> "Ted" + * $.String.getObject("Foo.Bar.Zar") //-> "Ted" * * @param {String} name the name of the object to look for * @param {Array} [roots] an array of root objects to look for the