node.js revision 6ea48d96f5a25dc7cb072787412ae2d88fc34f32
/**
* The NodeList Utility provides a DOM-like interface for interacting with DOM nodes.
* @module node
* @submodule node-list
*/
/**
* The NodeList class provides a wrapper for manipulating DOM NodeLists.
* Use Y.get() to retrieve NodeList instances.
*
* <strong>NOTE:</strong> NodeList properties are accessed using
* the <code>set</code> and <code>get</code> methods.
*
* @class NodeList
* @constructor
*/
Y.Array._diff = function(a, b) {
var removed = [],
present = false;
present = false;
if (a[i] === b[j]) {
present = true;
continue outer;
}
}
if (!present) {
}
}
return removed;
};
Y.Array.diff = function(a, b) {
return {
};
};
// "globals"
var g_nodelists = [],
UID = '_yuid',
if (typeof nodes === 'string') {
}
Y.stamp(this);
};
// end "globals"
style: {
value: {}
}
};
NodeList._instances = [];
} else {
}
};
// call with instance context
// TODO: use node.set if instance exists
if (!instance) {
}
});
};
// call with instance context
ret = [];
// TODO: use node.get if instance exists
if (!instance) { // reuse tmp instance
}
});
return ret;
};
initializer: function(config) {
},
/**
* Retrieves the Node instance at the given index.
* @method item
*
* @param {Number} index The index of the target Node.
* @return {Node} The Node instance at the given index.
*/
},
/**
* Applies the given function to each Node in the NodeList.
* @method each
* @param {Function} fn The function to apply
* @param {Object} context optional An optional context to apply the function with
* Default context is the NodeList instance
* @return {NodeList} NodeList containing the updated collection
* @chainable
*/
var instance = this;
});
},
/**
* Filters the NodeList instance down to only nodes matching the given selector.
* @method filter
* @param {String} selector The selector to filter against
* @return {NodeList} NodeList containing the updated collection
* @see Selector
*/
},
}
},
}
},
ret;
}
},
destructor: function() {
g_nodelists[this[UID]] = [];
},
refresh: function() {
var doc,
diff,
if (this._query) {
if (g_nodelists[this[UID]] &&
}
}
},
/**
* Returns the current number of items in the NodeList.
* @method size
* @return {Int} The number of items in the NodeList.
*/
size: function() {
},
toString: function() {
var str = '',
}
}
}
}
},
getter: function() {
},
}
});
}
}, true);
});
// zero-length result returns null
};
/**
* The Node Utility provides a DOM-like interface for interacting with DOM nodes.
* @module node
* @submodule node-base
*/
/**
* The NodeList class provides a wrapper for manipulating DOM NodeLists.
* Use Y.get() to retrieve NodeList instances.
*
* <strong>NOTE:</strong> NodeList properties are accessed using
* the <code>set</code> and <code>get</code> methods.
*
* @class NodeList
* @constructor
*/
// "globals"
var g_nodes = [],
DOT = '.',
NODE_NAME = 'nodeName',
NODE_TYPE = 'nodeTypType',
TAG_NAME = 'tagName',
UID = '_yuid',
},
SuperConstr = Y.Base,
// end "globals"
Node.DOM_EVENTS = {
click: true
};
Node._instances = {};
};
if (val !== null && (
) {
val = null; // not allowed to go outside of root node
} else {
} else { // assume nodeList
}
}
} else {
if (depth > 0) {
for (var i in val) { // TODO: test this and pull hasOwnProperty check if safe?
}
}
}
}
}
} else {
}
return val;
};
if (typeof name === 'string') {
ret;
return ret;
};
}
} else {
});
}
};
var instance = null;
if (node) {
new Node({
});
}
return instance;
};
};
/*
style: {
setter: function(val, e) {
var node = g_nodes[this[UID]],
name = e.attrName,
path;
if (node) {
if (typeof val === 'string' && name.indexOf(DOT) > -1) {
path = name.split('.');
Y.DOM.setStyle(node, path[1], val);
} else { // assume multiple styles
Y.DOM.setStyles(node, val);
}
} else {
}
},
value: {}
},
*/
text: {
getter: function() {
},
readOnly: true
},
'options': {
getter: function() {
}
},
/**
* Returns a NodeList instance.
* @property children
* @type NodeList
*/
'children': {
getter: function() {
children = [];
if (childNodes[i][TAG_NAME]) {
}
}
}
}
},
restricted: {
writeOnce: true,
value: false
}
};
// call with instance context
if (path) {
allowSet = false;
}
}
} else {
}
return val;
};
// call with instance context
};
toString: function() {
var str = '',
if (node) {
}
}
// TODO: add yuid?
}
},
_addDOMAttr: function(attr) {
getter: function() {
},
}
});
} else {
}
},
},
}
},
/**
* Detaches a DOM event handler.
* @method detach
* @param {String} type The type of DOM Event
* @param {Function} fn The handler to call when the event fires
*/
},
this._addDOMAttr(attr);
}
},
this._addDOMAttr(attr);
}
},
destructor: function() {
}
}, true);
/**
* Extended Node interface for managing classNames.
* @module node
* @submodule node
* @for Node
*/
var methods = [
/**
* Determines whether the node has the given className.
* @method hasClass
* @param {String} className the class name to search for
* @return {Boolean} Whether or not the node has the given class.
*/
'hasClass',
/**
* Adds a class name to the node.
* @method addClass
* @param {String} className the class name to add to the node's class attribute
* @chainable
*/
'addClass',
/**
* Removes a class name from the node.
* @method removeClass
* @param {String} className the class name to remove from the node's class attribute
* @chainable
*/
'removeClass',
/**
* Replace a class with another class.
* If no oldClassName is present, the newClassName is simply added.
* @method replaceClass
* @param {String} oldClassName the class name to be replaced
* @param {String} newClassName the class name that will be replacing the old class name
* @chainable
*/
'replaceClass',
/**
* If the className exists on the node it is removed, if it doesn't exist it is added.
* @method toggleClass
* @param {String} className the class name to be toggled
* @chainable
*/
'toggleClass'
];
//Y.NodeList.importMethod(Y.DOM, methods);