]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - jssource/src_files/include/javascript/yui3/build/node/node-deprecated.js
Release 6.5.0
[Github/sugarcrm.git] / jssource / src_files / include / javascript / yui3 / build / node / node-deprecated.js
1 /*
2 Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3 Code licensed under the BSD License:
4 http://developer.yahoo.com/yui/license.html
5 version: 3.3.0
6 build: 3167
7 */
8 YUI.add('node-deprecated', function(Y) {
9
10 var Y_Node = Y.Node;
11
12 /*
13  * Flat data store for off-DOM usage 
14  * @config data
15  * @type any
16  * @deprecated Use getData/setData
17  */
18 Y_Node.ATTRS.data = {
19     getter: function() { 
20         return this._dataVal; 
21     },
22     setter: function(val) { 
23         this._dataVal = val;
24         return val;
25     },
26     value: null
27 };
28
29 /**
30  * Returns a single Node instance bound to the node or the
31  * first element matching the given selector.
32  * @method Y.get
33  * @deprecated Use Y.one
34  * @static
35  * @param {String | HTMLElement} node a node or Selector 
36  * @param {Y.Node || HTMLElement} doc an optional document to scan. Defaults to Y.config.doc. 
37  */
38 Y.get = Y_Node.get = function() {
39     return Y_Node.one.apply(Y_Node, arguments);
40 };
41
42
43 Y.mix(Y_Node.prototype, {
44     /**
45      * Retrieves a Node instance of nodes based on the given CSS selector. 
46      * @method query
47      * @deprecated Use one()
48      * @param {string} selector The CSS selector to test against.
49      * @return {Node} A Node instance for the matching HTMLElement.
50      */
51     query: function(selector) {
52         return this.one(selector);
53     },
54
55     /**
56      * Retrieves a nodeList based on the given CSS selector. 
57      * @method queryAll
58      * @deprecated Use all()
59      * @param {string} selector The CSS selector to test against.
60      * @return {NodeList} A NodeList instance for the matching HTMLCollection/Array.
61      */
62     queryAll: function(selector) {
63         return this.all(selector);
64     },
65
66     /**
67      * Applies the given function to each Node in the NodeList.
68      * @method each
69      * @deprecated Use NodeList
70      * @param {Function} fn The function to apply 
71      * @param {Object} context optional An optional context to apply the function with
72      * Default context is the NodeList instance
73      * @chainable
74      */
75     each: function(fn, context) {
76         context = context || this;
77         return fn.call(context, this);
78     },
79
80     /**
81      * Retrieves the Node instance at the given index. 
82      * @method item
83      * @deprecated Use NodeList
84      *
85      * @param {Number} index The index of the target Node.
86      * @return {Node} The Node instance at the given index.
87      */
88     item: function(index) {
89         return this;
90     },
91
92     /**
93      * Returns the current number of items in the Node.
94      * @method size
95      * @deprecated Use NodeList
96      * @return {Int} The number of items in the Node. 
97      */
98     size: function() {
99         return this._node ? 1 : 0;
100     }
101
102 });
103
104
105
106
107 }, '3.3.0' ,{requires:['node-base']});