formatting

This commit is contained in:
rolux 2014-09-22 14:34:44 +02:00
parent 78c1b55d85
commit 55999d654c

View file

@ -81,6 +81,7 @@ Ox.$ = Ox.element = function $(value) {
return elements.length ? Ox.extend(
Ox.zipObject(Ox.range(elements.length), elements
), {
/*@
add <f> Adds another DOM object to this DOM object
(other) -> This DOM object
@ -91,6 +92,7 @@ Ox.$ = Ox.element = function $(value) {
this.length = elements.length;
return this;
},
/*@
addClass <f> Adds a class name to all elements
(className) -> <o> This DOM object
@ -105,6 +107,7 @@ Ox.$ = Ox.element = function $(value) {
});
return this;
},
/*@
append <f> Appends one or more DOM objects to this DOM object
(object[, object[, ...]]) -> <o> This DOM object
@ -121,6 +124,7 @@ Ox.$ = Ox.element = function $(value) {
});
return this;
},
/*@
appendTo <f> Appends this DOM object to another DOM object
(object) -> <o> This DOM object
@ -134,6 +138,7 @@ Ox.$ = Ox.element = function $(value) {
});
return this;
},
/*@
attr <f> Gets or sets an attribute for all elements
(key) -> <s> Value
@ -165,6 +170,7 @@ Ox.$ = Ox.element = function $(value) {
return this;
}
},
/*@
children <f> Returns the unique list of children of all elements
([selector]) -> <[h]> Children
@ -178,6 +184,7 @@ Ox.$ = Ox.element = function $(value) {
return Ox.$(child).is(selector);
}) : children);
},
/*@
css <f> Gets or sets a CSS attribute for all elements
(key) -> <s> Value
@ -199,6 +206,7 @@ Ox.$ = Ox.element = function $(value) {
return this;
}
},
/*@
data <f> Gets or sets data
() -> <o> All data
@ -220,10 +228,12 @@ Ox.$ = Ox.element = function $(value) {
return this;
}
},
/*@
elements <a> All elements
@*/
elements: elements,
/*@
eq <f> Reduces the list of elements to the one at the given index
() -> <o> This DOM object
@ -237,6 +247,7 @@ Ox.$ = Ox.element = function $(value) {
this.length = 1;
return this;
},
/*@
empty <f> Empties the inner HTML of all elements
() -> <o> This DOM object
@ -244,6 +255,7 @@ Ox.$ = Ox.element = function $(value) {
empty: function empty() {
return this.html('');
},
/*@
every <f> Tests if every element satisfies a given condition
(test) -> True if every element passes the test
@ -252,6 +264,7 @@ Ox.$ = Ox.element = function $(value) {
every: function every() {
return Array.prototype.every.apply(elements, arguments);
},
/*@
filter <f> Filters all elements by a given condition
(test) -> Array of matching elements
@ -260,6 +273,7 @@ Ox.$ = Ox.element = function $(value) {
filter: function filter() {
return Array.prototype.filter.apply(elements, arguments);
},
/*@
find <f> Find all descendant elements matching a CSS selector
([selector]) -> <[h]> Elements
@ -270,6 +284,7 @@ Ox.$ = Ox.element = function $(value) {
return Ox.slice(element.querySelectorAll(selector || '*'));
}))));
},
/*@
forEach <f> Loops over all elements
(iterator) -> This DOM object
@ -279,6 +294,7 @@ Ox.$ = Ox.element = function $(value) {
Array.prototype.forEach.apply(elements, arguments);
return this;
},
/*@
hasClass <f> Returns true if this element has a given class
(className) -> <b> True if this element has the class
@ -289,6 +305,7 @@ Ox.$ = Ox.element = function $(value) {
return Ox.contains(element.className.split(' '), string);
});
},
/*@
height <f> Returns the height of the first element
() -> <n> Height in px
@ -296,6 +313,7 @@ Ox.$ = Ox.element = function $(value) {
height: function height() {
return elements[0].offsetHeight;
},
/*@
hide <f> Hides all elements
() -> <o> This DOM object
@ -304,6 +322,7 @@ Ox.$ = Ox.element = function $(value) {
previousDisplay = this.css('display');
return this.css({display: 'none'});
},
/*@
html <f> Gets or sets the innerHTML of all elements
() -> <s> The inner HTML
@ -325,6 +344,7 @@ Ox.$ = Ox.element = function $(value) {
return this;
}
},
/*@
insertAfter <f> Inserts this DOM object after another DOM object
(object) -> <o> This DOM object
@ -337,6 +357,7 @@ Ox.$ = Ox.element = function $(value) {
})
return this;
},
/*@
insertBefore <f> Inserts this DOM object before another DOM object
(object) -> <o> This DOM object
@ -348,6 +369,7 @@ Ox.$ = Ox.element = function $(value) {
});
return this;
},
/*@
is <f> Tests if any element matches a CSS selector
(selector) -> <b> True if the element matches the selector
@ -363,10 +385,12 @@ Ox.$ = Ox.element = function $(value) {
return Ox.contains(parent.querySelectorAll(selector), element);
});
},
/*@
length <n> Number of elements
@*/
length: elements.length,
/*@
map <f> Transforms all elements
(iterator) -> [] Transformed elements
@ -375,6 +399,7 @@ Ox.$ = Ox.element = function $(value) {
map: function map() {
return Array.prototype.filter.map(elements, arguments);
},
/*@
next <f> Returns the unique list of siblings directly after all elements
() -> <[h]> Siblings
@ -384,6 +409,7 @@ Ox.$ = Ox.element = function $(value) {
return element.nextSibling;
}))));
},
/*@
nextAll <f> Returns the unique list of siblings after all elements
() -> <[h]> Siblings
@ -402,6 +428,7 @@ Ox.$ = Ox.element = function $(value) {
});
return Ox.$(Ox.unique(siblings));
},
/*@
off <f> Unbinds a callback from an event
(event) -> <o> This DOM object (unbinds all callbacks)
@ -423,6 +450,7 @@ Ox.$ = Ox.element = function $(value) {
});
return this;
},
/*@
on <f> Binds a callback to an event
(event, callback) -> <o> This DOM object
@ -440,6 +468,7 @@ Ox.$ = Ox.element = function $(value) {
});
return this;
},
/*@
one <f> Binds a callback to an event and unbinds it on first invocation
(event, callback) -> <o> This DOM object
@ -458,6 +487,7 @@ Ox.$ = Ox.element = function $(value) {
});
return this;
},
/*@
parent <f> Returns the unique list of parents of all elements
() -> <[h]> Parent elements
@ -467,6 +497,7 @@ Ox.$ = Ox.element = function $(value) {
return element.parentNode;
}))));
},
/*@
parents <f> Returns the unique list of all ancestors of all elements
([selector]) -> <[h]> Ancestor elements
@ -489,6 +520,7 @@ Ox.$ = Ox.element = function $(value) {
return Ox.$(parent).is(selector);
}) : parents);
},
/*@
prepend <f> Prepends one or more DOM objects to this DOM object
(object[, object[, ...]]) -> <o> DOM object
@ -506,6 +538,7 @@ Ox.$ = Ox.element = function $(value) {
});
return this;
},
/*@
prependTo <f> Prepends this DOM object to another DOM object
(object) -> <o> This DOM object
@ -520,6 +553,7 @@ Ox.$ = Ox.element = function $(value) {
});
return this;
},
/*@
prev <f> Returns the unique list of siblings directly before all elements
() -> <[h]> Siblings
@ -529,6 +563,7 @@ Ox.$ = Ox.element = function $(value) {
return element.previousSibling;
}))));
},
/*@
prevAll <f> Returns the unique list of siblings before all elements
() -> <[h]> Siblings
@ -547,12 +582,14 @@ Ox.$ = Ox.element = function $(value) {
});
return Ox.$(Ox.unique(siblings));
},
/*@
reduce <f> Applies `reduce` to all elements
@*/
reduce: function reduce() {
return Array.prototype.reduce.apply(elements, arguments);
},
/*@
remove <f> Removes all element from the DOM
() -> <o> This DOM object
@ -566,6 +603,7 @@ Ox.$ = Ox.element = function $(value) {
});
return this;
},
/*@
removeAttr <f> Removes an attribute from all elements
(key) -> <o> This DOM object
@ -581,6 +619,7 @@ Ox.$ = Ox.element = function $(value) {
});
return this;
},
/*@
removeClass <f> Removes a class name from all elements
(className) -> <o> This DOM object
@ -597,6 +636,7 @@ Ox.$ = Ox.element = function $(value) {
});
return this;
},
/*@
replace <f> Replaces another DOM object with this DOM object
(object) -> <o> This DOM object
@ -616,6 +656,7 @@ Ox.$ = Ox.element = function $(value) {
});
return this;
},
/*@
replaceWith <f> Replaces this DOM object with another DOM object
(object) -> <o> This DOM object
@ -635,6 +676,7 @@ Ox.$ = Ox.element = function $(value) {
});
return this;
},
/*@
show <f> Shows all elements
() -> This DOM object
@ -642,6 +684,7 @@ Ox.$ = Ox.element = function $(value) {
show: function show() {
return this.css({display: previousDisplay || 'block'});
},
/*@
siblings <f> Returns all siblings of all elements
([selector]) -> <[h]> Siblings
@ -660,6 +703,7 @@ Ox.$ = Ox.element = function $(value) {
return Ox.$(sibling).is(selector);
}) : siblings);
},
/*@
some <f> Tests if some elements satisfy a given condition
(test) -> True if some elements pass the test
@ -668,6 +712,7 @@ Ox.$ = Ox.element = function $(value) {
some: function some() {
return Array.prototype.some.apply(elements, arguments);
},
/*@
text <f> Gets or sets the text contents of all elements
() -> <s> The text contents
@ -690,6 +735,7 @@ Ox.$ = Ox.element = function $(value) {
return this;
}
},
/*@
toggleClass <f> Toggles a class name for all elements
(className) -> <o> This DOM object
@ -704,6 +750,7 @@ Ox.$ = Ox.element = function $(value) {
})
return this;
},
/*@
trigger <f> Triggers an event
(event) -> <o> This DOM object
@ -716,6 +763,7 @@ Ox.$ = Ox.element = function $(value) {
});
return this;
},
/*@
val <f> Gets the value of the first or sets the value of all elements
() -> <s> Value
@ -733,6 +781,7 @@ Ox.$ = Ox.element = function $(value) {
return this;
}
},
/*@
width <f> Returns the width of the first element
() -> <n> Width in px
@ -740,6 +789,7 @@ Ox.$ = Ox.element = function $(value) {
width: function width() {
return elements[0].offsetWidth;
}
}) : null;
};