Merge branch 'MDL-32509' of git://github.com/danpoltawski/moodle
[moodle.git] / lib / yui / 3.5.0 / build / node-deprecated / node-deprecated.js
blobf07063938dc9688cda86ce521c1c9ba8d1ebaaeb
1 /*
2 YUI 3.5.0 (build 5089)
3 Copyright 2012 Yahoo! Inc. All rights reserved.
4 Licensed under the BSD License.
5 http://yuilibrary.com/license/
6 */
7 YUI.add('node-deprecated', function(Y) {
9 /**
10  * @module node
11  * @submodule node-deprecated
12  * @deprecated
13  */
15 var Y_Node = Y.Node;
18  * Flat data store for off-DOM usage
19  * @config data
20  * @type any
21  * @deprecated Use getData/setData
22  * @for Node
23  */
24 Y_Node.ATTRS.data = {
25     getter: function() {
26         return this._dataVal;
27     },
28     setter: function(val) {
29         this._dataVal = val;
30         return val;
31     },
32     value: null
35 /**
36  * Returns a single Node instance bound to the node or the
37  * first element matching the given selector.
38  * @method get
39  * @for YUI
40  * @deprecated Use Y.one
41  * @static
42  * @param {String | HTMLElement} node a node or Selector
43  * @param {Node | HTMLElement} doc an optional document to scan. Defaults to Y.config.doc.
44  */
46 /**
47  * Returns a single Node instance bound to the node or the
48  * first element matching the given selector.
49  * @method get
50  * @for Node
51  * @deprecated Use Y.one
52  * @static
53  * @param {String | HTMLElement} node a node or Selector
54  * @param {Node | HTMLElement} doc an optional document to scan. Defaults to Y.config.doc.
55  */
56 Y.get = Y_Node.get = function() {
57     return Y_Node.one.apply(Y_Node, arguments);
61 Y.mix(Y_Node.prototype, {
62     /**
63      * Retrieves a Node instance of nodes based on the given CSS selector.
64      * @method query
65      * @deprecated Use one()
66      * @param {string} selector The CSS selector to test against.
67      * @return {Node} A Node instance for the matching HTMLElement.
68      */
69     query: function(selector) {
70         return this.one(selector);
71     },
73     /**
74      * Retrieves a nodeList based on the given CSS selector.
75      * @method queryAll
76      * @deprecated Use all()
77      * @param {string} selector The CSS selector to test against.
78      * @return {NodeList} A NodeList instance for the matching HTMLCollection/Array.
79      */
80     queryAll: function(selector) {
81         return this.all(selector);
82     },
84     /**
85      * Applies the given function to each Node in the NodeList.
86      * @method each
87      * @deprecated Use NodeList
88      * @param {Function} fn The function to apply
89      * @param {Object} context optional An optional context to apply the function with
90      * Default context is the NodeList instance
91      * @chainable
92      */
93     each: function(fn, context) {
94         context = context || this;
95         return fn.call(context, this);
96     },
98     /**
99      * Retrieves the Node instance at the given index.
100      * @method item
101      * @deprecated Use NodeList
102      *
103      * @param {Number} index The index of the target Node.
104      * @return {Node} The Node instance at the given index.
105      */
106     item: function(index) {
107         return this;
108     },
110     /**
111      * Returns the current number of items in the Node.
112      * @method size
113      * @deprecated Use NodeList
114      * @return {Int} The number of items in the Node.
115      */
116     size: function() {
117         return this._node ? 1 : 0;
118     }
125 }, '3.5.0' ,{requires:['node-base']});