Sha256: c403262ca45a5ea5977598829553f7a83b68302fae1dcfe8fdd41829f6ecf6fb

Contents?: true

Size: 1.22 KB

Versions: 10

Compression:

Stored size: 1.22 KB

Contents

dojo.provide("dojo.NodeList-html");
dojo.require("dojo.html");

/*=====
dojo["NodeList-html"] = {
	// summary: Adds a chainable html method to dojo.query() / Nodelist instances for setting/replacing node content
};
=====*/

dojo.extend(dojo.NodeList, {
	html: function(content, /* Object? */params){
		//	summary:
		//		see `dojo.html.set()`. Set the content of all elements of this NodeList
		//
		// description: 
		//		Based around `dojo.html.set()`, set the content of the Elements in a 
		//		NodeList to the given content (string/node/nodelist), with optional arguments
		//		to further tune the set content behavior.
		//
		//	example:
		//	| dojo.query(".thingList").html("<li dojoType='dojo.dnd.Moveable'>1</li><li dojoType='dojo.dnd.Moveable'>2</li><li dojoType='dojo.dnd.Moveable'>3</li>",
		//	| { 
		//	| 	parseContent: true, 
		//	| 	onBegin: function(){
		//	| 		this.content = this.content.replace(/([0-9])/g, this.id + ": $1");
		//	| 		this.inherited("onBegin", arguments);
		//	| 	}
		//	| }).removeClass("notdone").addClass("done");

		var dhs = new dojo.html._ContentSetter(params || {});
		this.forEach(function(elm){
			dhs.node = elm; 
			dhs.set(content);
			dhs.tearDown();
		});
		return this; // dojo.NodeList
	}
});

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
dojo_src-1.5.0 dojo/dojo/NodeList-html.js
dojo_src-1.4.3 dojo/dojo/NodeList-html.js
dojo_src-1.4.102 dojo/dojo/NodeList-html.js
dojo-pkg-1.132.0 data/dojo-release-1.3.2-src/dojo/NodeList-html.js
dojo-pkg-1.120.0 data/dojo-release-1.2.0-src/dojo/NodeList-html.js
dojo-pkg-1.121.0 data/dojo-release-1.2.1-src/dojo/NodeList-html.js
dojo-pkg-1.122.0 data/dojo-release-1.2.2-src/dojo/NodeList-html.js
dojo-pkg-1.123.0 data/dojo-release-1.2.3-src/dojo/NodeList-html.js
dojo-pkg-1.130.0 data/dojo-release-1.3.0-src/dojo/NodeList-html.js
dojo-pkg-1.131.0 data/dojo-release-1.3.1-src/dojo/NodeList-html.js