forked from Botanical/BotanJS
		
	IDOMElement: added clear, renamed lootChildren
This commit is contained in:
		| @@ -10,23 +10,24 @@ | |||||||
| 	var IDOMObject = ns[ NS_INVOKE ]( "IDOMObject" ); | 	var IDOMObject = ns[ NS_INVOKE ]( "IDOMObject" ); | ||||||
|  |  | ||||||
| 	// IDOMElement, augmented element wrapper utilizing IKeys | 	// 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 ); | 			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["foreach"] = this.foreach.bind(element); | ||||||
| 			this["reverseChild"] = this.reverseChild.bind(element); | 			this["reverseChild"] = this.reverseChild.bind( element ); | ||||||
| 			this["first"] = this.first.bind(element); | 			this["clear"] = this.clear.bind( element ); | ||||||
| 			this["last"] = this.last.bind(element); | 			this["first"] = this.first.bind( element ); | ||||||
| 			this["contains"] = this.contains.bind(element); | 			this["last"] = this.last.bind( element ); | ||||||
|  | 			this["contains"] = this.contains.bind( element ); | ||||||
|  |  | ||||||
| 			// Org values | 			// Org values | ||||||
| 			this["style"] = element.style; | 			this["style"] = element.style; | ||||||
| @@ -76,7 +77,7 @@ | |||||||
| 		} | 		} | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	IDOMElement.prototype.lootChildren = function ( element ) | 	IDOMElement.prototype.loot = function ( element ) | ||||||
| 	{ | 	{ | ||||||
| 		var _nodes = element.childNodes; | 		var _nodes = element.childNodes; | ||||||
| 		while(_nodes.length) | 		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) | 	IDOMElement.prototype.getDAttribute = function(name) | ||||||
| 	{ | 	{ | ||||||
| 		var i = this.getAttribute("data-" + name); | 		var i = this.getAttribute("data-" + name); | ||||||
|   | |||||||
| @@ -6,7 +6,9 @@ Dandelion.IDOMElement.getDAttribute; | |||||||
| /** @type {Function} */ | /** @type {Function} */ | ||||||
| Dandelion.IDOMElement.setAttribute; | Dandelion.IDOMElement.setAttribute; | ||||||
| /** @type {Function} */ | /** @type {Function} */ | ||||||
| Dandelion.IDOMElement.lootChildren; | Dandelion.IDOMElement.loot; | ||||||
|  | /** @type {Function} */ | ||||||
|  | Dandelion.IDOMElement.clear; | ||||||
| /** @type {Function} */ | /** @type {Function} */ | ||||||
| Dandelion.IDOMElement.foreach; | Dandelion.IDOMElement.foreach; | ||||||
| /** @type {Function} */ | /** @type {Function} */ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user