IDOMElement: added clear, renamed lootChildren
This commit is contained in:
parent
6c9011f92c
commit
866bf6db28
@ -10,23 +10,24 @@
|
||||
var IDOMObject = ns[ NS_INVOKE ]( "IDOMObject" );
|
||||
|
||||
// IDOMElement, augmented element wrapper utilizing IKeys
|
||||
var IDOMElement = function (element, sw)
|
||||
var IDOMElement = function ( element, sw )
|
||||
{
|
||||
if (element instanceof IDOMElement) return element;
|
||||
if ( element instanceof IDOMElement ) return element;
|
||||
|
||||
if (sw)
|
||||
if ( sw )
|
||||
{
|
||||
IDOMObject.call( this, element, true );
|
||||
|
||||
this["getDAttribute"] = this.getDAttribute.bind(element);
|
||||
this["getDAttribute"] = this.getDAttribute.bind( element );
|
||||
|
||||
this["lootChildren"] = this.lootChildren.bind(element);
|
||||
this["loot"] = this.loot.bind( element );
|
||||
|
||||
this["foreach"] = this.foreach.bind(element);
|
||||
this["reverseChild"] = this.reverseChild.bind(element);
|
||||
this["first"] = this.first.bind(element);
|
||||
this["last"] = this.last.bind(element);
|
||||
this["contains"] = this.contains.bind(element);
|
||||
this["reverseChild"] = this.reverseChild.bind( element );
|
||||
this["clear"] = this.clear.bind( element );
|
||||
this["first"] = this.first.bind( element );
|
||||
this["last"] = this.last.bind( element );
|
||||
this["contains"] = this.contains.bind( element );
|
||||
|
||||
// Org values
|
||||
this["style"] = element.style;
|
||||
@ -76,7 +77,7 @@
|
||||
}
|
||||
};
|
||||
|
||||
IDOMElement.prototype.lootChildren = function ( element )
|
||||
IDOMElement.prototype.loot = function ( element )
|
||||
{
|
||||
var _nodes = element.childNodes;
|
||||
while(_nodes.length)
|
||||
@ -85,6 +86,13 @@
|
||||
}
|
||||
};
|
||||
|
||||
IDOMElement.prototype.clear = function ()
|
||||
{
|
||||
var _nodes = this.childNodes;
|
||||
while( _nodes.length )
|
||||
this.removeChild( _nodes[0] );
|
||||
};
|
||||
|
||||
IDOMElement.prototype.getDAttribute = function(name)
|
||||
{
|
||||
var i = this.getAttribute("data-" + name);
|
||||
|
@ -6,7 +6,9 @@ Dandelion.IDOMElement.getDAttribute;
|
||||
/** @type {Function} */
|
||||
Dandelion.IDOMElement.setAttribute;
|
||||
/** @type {Function} */
|
||||
Dandelion.IDOMElement.lootChildren;
|
||||
Dandelion.IDOMElement.loot;
|
||||
/** @type {Function} */
|
||||
Dandelion.IDOMElement.clear;
|
||||
/** @type {Function} */
|
||||
Dandelion.IDOMElement.foreach;
|
||||
/** @type {Function} */
|
||||
|
Loading…
Reference in New Issue
Block a user