/Dominator

Primary LanguageJavaScriptGNU General Public License v3.0GPL-3.0

This file contains both the Helpers and Dominator classes within the Techknow namespace.

v 1.0.7 updates: fixed a bug that prevented multiple instances from being displayed on the page

Basic Usage:

var domElement = new Techknow.Dominator({
	insert: {
		into: 'body',
		//before: '.content',
		//after: '.header',
		//atTheStartOf: 'body',
		//atTheEndOf: 'body',
	},
	structure: [{
		tag: 'article',
		attr: {
			class: 'myNewArticleElementClassName otherClassName'
		},
		listeners: {
			event: 'click', // jquery event
			data: this, // item to be passed into callback as e.data
			target: '.childElementForDelegation', // sets the scope of 'this' in the callback
			action: function(e) {
				console.log('Running most awesome code here');
			},
		},
		children: [{
			tag: 'div',
			children: [{
				tag: 'span',
				text: 'My Awesome Article Div Span Text!',
				attr: {
					'data-span-prop': 'some data on the data-span-prop property',
				}
			}],
		}]
	}],
});
domElement.render(); //inserts element into page at insertion point
// domElement.buildNode(); //returns a javascript dom node representation without inserting into the dom