IDOMElement: added clear, renamed lootChildren

This commit is contained in:
斟酌 鵬兄 2016-05-25 12:15:36 +08:00
parent 6c9011f92c
commit 866bf6db28
2 changed files with 21 additions and 11 deletions

View File

@ -20,10 +20,11 @@
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["clear"] = this.clear.bind( element );
this["first"] = this.first.bind( element );
this["last"] = this.last.bind( element );
this["contains"] = this.contains.bind( element );
@ -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);

View File

@ -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} */