Skip to content

Commit

Permalink
Fixed some jsdocs and parameter type missmatches inside the library.
Browse files Browse the repository at this point in the history
  • Loading branch information
Joscha Rohmann committed Aug 19, 2016
1 parent fbb8831 commit da3c09d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
13 changes: 8 additions & 5 deletions src/query/VirtualElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ define([
/**
* Gets or sets the inner text of the element.
*
* @param {String} [html] - The new text that will be set. Provide the parameter only if you want to set new text.
* @returns {String|VirtualElement} - returns itself if it is used as a setter(no parameters specified)
* and returns the inner text of the element if it used as a getter.
* @param {String} [text] - The new text that will be set. Provide the parameter only if you want to set new text.
* @returns {String|VirtualElement} - returns itself if it is used as a setter
* and returns the inner text of the element if it used as a getter (no parameters specified).
*/
text: function (text) {
if (arguments.length > 0) {
Expand Down Expand Up @@ -113,7 +113,7 @@ define([
* Gets or sets an attribute value
*
* @param {String} attributeName - The attribute name to be set or retrieved.
* @param {String} [attributeValue] - The value to be set to the attribute.
* @param {String|Number|boolean} [attributeValue] - The value to be set to the attribute.
* @returns {VirtualElement|String} - Returns the VirtualElement itself if you set an attribute.
* Returns the attribute name value if only the first parameter is specified.
*/
Expand Down Expand Up @@ -206,7 +206,7 @@ define([
* Gets or sets a CSS property
*
* @param {String} name - The CSS property name to be set or retrieved
* @param {String} [value] - The value to be set to the CSS property
* @param {String|number|boolean} [value] - The value to be set to the CSS property
* @returns {VirtualElement|String} - Returns the VirtualElement itself if you use the method as a setter.
* Returns the CSS property value if only the first parameter is specified.
*/
Expand Down Expand Up @@ -754,6 +754,9 @@ define([
function replaceStyleAttribute(match) {
return '-' + match.toLowerCase();
}
//@if DEBUG
blocks.debug.addType('blocks.VirtualElement', VirtualElement.Is);
//@endif

return VirtualElement;
});
15 changes: 8 additions & 7 deletions src/query/observable.js
Original file line number Diff line number Diff line change
Expand Up @@ -568,13 +568,14 @@ define([
* to be removed by providing a callback
*
* @memberof array
* @param {Function} [callback] - Optional callback function which filters which items
* to be removed. Returning a truthy value will remove the item and vice versa
* @param {Function|*} [callbackOrValue] - Optional callback function which filters which items
* to be removed. Returning a truthy value will remove the item and vice versa.
* If the passed value is not a function value matching the passed value will be removed.
* @param {*} [thisArg] - Optional this context for the callback function
* @param {boolean} [removeOne] - If set only the first entry will be removed. Mostly used in internal functions.
* @returns {blocks.observable} - Returns the observable itself - return this;
*/
removeAll: function (callback, thisArg, removeOne) {
removeAll: function (callbackOrValue, thisArg, removeOne) {
var array = this.__value__;
var chunkManager = this._chunkManager;
var items;
Expand All @@ -601,12 +602,12 @@ define([
index: 0
});
} else {
var isCallbackAFunction = blocks.isFunction(callback);
var isCallbackAFunction = blocks.isFunction(callbackOrValue);
var value;

for (i = 0; i < array.length; i++) {
value = array[i];
if (value === callback || (isCallbackAFunction && callback.call(thisArg, value, i, array))) {
if (value === callbackOrValue || (isCallbackAFunction && callbackOrValue.call(thisArg, value, i, array))) {
this.splice(i, 1);
i -= 1;
if (removeOne) {
Expand Down Expand Up @@ -714,7 +715,7 @@ define([
* @returns {number} The new length of the observable array
*/
push: function () {
this.addMany(arguments);
this.addMany(blocks.toArray(arguments));
return this.__value__.length;
},

Expand Down Expand Up @@ -898,7 +899,7 @@ define([
* @returns {number} The new length of the observable array.
*/
unshift: function () {
this.addMany(arguments, 0);
this.addMany(blocks.toArray(arguments), 0);
return this.__value__.length;
}
}
Expand Down

0 comments on commit da3c09d

Please sign in to comment.