Permalink
Browse files

Clarified possible return of null from node.one()

Documentation change to make it clear that null (not undefined) will be returned by calls to node.one() that do not have a successful match.
  • Loading branch information...
lexander authored and ericf committed Oct 31, 2012
1 parent 152bf4f commit c3e7121d9ebe9ca1b30b5a49f1c535e711f3d21c
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/node/js/node-core.js
View
@@ -613,11 +613,14 @@ Y.mix(Y_Node.prototype, {
},
/**
- * Retrieves a Node instance of nodes based on the given CSS selector.
+ * Retrieves a single Node instance, the first element matching the given
+ * CSS selector.
+ * Returns null if no match found.
* @method one
*
* @param {string} selector The CSS selector to test against.
- * @return {Node} A Node instance for the matching HTMLElement.
+ * @return {Node | null} A Node instance for the matching HTMLElement or null
+ * if no match found.
*/
one: function(selector) {
return Y.one(Y.Selector.query(selector, this._node, true));

0 comments on commit c3e7121

Please sign in to comment.