<commit_before>(function(context, eval){

	// --------------------------------------------------------
	// helper functions that do stuff
	// --------------------------------------------------------

	// lets you declare recursive anonamyous recursive functions
	function recursive(fn){
	    var bound = function(){
	        var inputs = Array.prototype.concat.call([bound], Array.prototype.splice.call(arguments, 0))
	        return fn.apply(null, inputs)
	    }
	    return bound
	}

	// modified method-overload v0.1.1
	var overload = (function(){var b=function(a,c){var d=!0;for(var e in c){"string"==typeof c[e]&&"!"===c[e][0]?typeof a[e]===c[e].substring(1)&&(d=!1):"object"==typeof a[e]&&"object"==typeof c[e]?d=b(a[e],c[e])&&d:typeof a[e]!==c[e]&&(d=!1)}return d};return function(){var a=this,c=arguments;1===arguments.length&&(c=arguments[0]);var d=[],e=function(){};e.use=e.args=function(){return e};var f=function(){for(var a in d){var c=d[a];if(b(arguments,c.m))return c.e.apply(this,arguments)}},g=function(){var g=arguments;return{use:function(h){return 0==g.length&&delete f.args,d.push({m:g,e:h}),c.length&&b(c,g)?(h.apply(a,c),e):f}}};return f.args=g,f}})();

	var converter = document.createElement("div")
    var instances = []

	// --------------------------------------------------------
	// The templater that does the heavy lifting kinda
	// --------------------------------------------------------
	var Scope = function(ele){
		// detect if new or just calling it
		var self = {}

		if (!ele){
			throw new Error("No element selected")
		}

		// set public methods into the prototype of this object.
		var public_method = {}
		Object.setPrototypeOf(self, public_method)

		// define public propertyies that can be gotten with .varname
		Object.defineProperty(public_method, "parent", {
			enumerable: false,
			configurable: false,
			get: function(){
				return ele.parentNode && ele.parentNode.scope
			}
		})

		Object.defineProperty(public_method, "children", {
			enumerable: false,
			configurable: false,
			get: function(){
				return instances.filter(function(scope){
                    return scope.parent == self
                })
			}
		})

		Object.defineProperty(public_method, "root", {
			enumerable: false,
			configurable: false,
			get: recursive(function(getParent, scope){
				scope = scope || self
				return (scope.parent)? getParent(scope.parent) : scope
			})
		})

		// set the "scope" property of every HTML element associated to self to provide a reference to self
		// most depended upon property in the framework
		var recursiveDefineScope = function(ele, recur){
			Object.defineProperty(ele, "scope", {
				enumerable: false,
				configurable: false,
				get: function(){
					return self
				}
			})

			if (recur !== false){
				Array.prototype.forEach.call(ele.querySelectorAll("*"), function(item){
					recursiveDefineScope(item, false)
				})
			}
		}
		recursiveDefineScope(ele)

		// begin dom manip functions

		var listeners = {}

		// public methods (kept in the prototype) for others to access
		public_method.on = overload()
			.args({scope:{on:"function"}, addEventListener: "function"}, "string", "function").use(function(ele, type, callback){
				if (ele.scope == self){
					//ele_on(ele, type, callback)
					var typeList = listeners[type] || (listeners[type] = []),
						repeat = false

					typeList.forEach(function(elfn){
						if (
							(elfn.fn == callback || elfn.fn.toString() == callback.toString()) &&
							(elfn.el == ele)
						){
							repeat = true
						}
					})

					if (!repeat){
						ele.addEventListener(type, callback)
						listeners[type].push({
							fn: callback,
							el: ele
						})
					}
					else {
						console.warn("listener is already registered")
					}
				}
				else {
					ele.scope.on(ele, type, callback)
				}
				return self
			})
			.args({"0":"object", length:"number", forEach:"function"}, "string", "function").use(function(eles, type, callback){
				eles.forEach(function(ele){
					self.on(ele, type, callback)
				})
				return self
			})
			.args("string", "string", "function").use(function(selector, type, callback){
				if(selector[0] == "$"){
					self.elements(selector).forEach( function(ele){
						self.on(ele, type, callback)
					})
				}
				else {
					console.warn("selector must begin with '$'")
				}
				return self
			})
			.args("string", "function").use(function(type, callback){
				self.on(ele, type, callback)
				return self
			})
			.args().use(function(){
				console.warn("on function inputs improperly formatted")
				return self
			})

		public_method.off = overload()
			.args({scope:{off:"function"}, addEventListener: "function"}, "string", "function").use(function(ele, type, callback){
				if (ele.scope == self){
					var typeList = listeners[type],
						found = false

					typeList && typeList.forEach(function(elfn, index){
						if (
							(elfn.fn == callback || elfn.fn.toString() == callback.toString()) &&
							elfn.el == ele
						){
							found = true
							ele.removeEventListener(type, elfn.fn)
							typeList.splice(index, 1)
						}
					})

					if (!found){
						console.warn("Listener is not currently registered")
					}
				}
				else {
					ele.scope.off(ele, type, callback)
				}
				return self
			})
			.args({"0":"object", length:"number", forEach:"function"}, "string", "function").use(function(eles, type, callback){
				eles.forEach(function(ele){
					self.off(ele, type, callback)
				})
			})
			.args("string", "string", "function").use(function(selector, type, callback){
				if(selector[0] == "$"){
					self.elements(selector).forEach( function(ele){
						self.off(ele, type, callback)
					})
				}
				else {
					console.warn("selector must begin with '$'")
				}
				return self
			})
			.args("string", "function").use(function(type, callback){
				self.off(ele, type, callback)
				return self
			})
			.args().use(function(){
				console.warn("off function inputs improperly formatted")
				return self
			})

		public_method.once = overload()
			.args({scope:{off:"function"}, addEventListener: "function"}, "string", "function").use(function(ele, type, callback){
				if (ele.scope == self){
					var cb = function(e){
						callback(e)
						self.off(ele, type, cb)
					}
					self.on(ele, type, cb)
				}
				else {
					ele.scope.once(ele, type, callback)
				}
				return self
			})
			.args({"0":"object", length:"number", forEach:"function"}, "string", "function").use(function(eles, type, callback){
				eles.forEach(function(ele){
					self.once(ele, type, callback)
				})
			})
			.args("string", "string", "function").use(function(selector, type, callback){
				if(selector[0] == "$"){
					self.elements(selector).forEach( function(ele){
						self.once(ele, type, callback)
					})
				}
				else {
					console.warn("selector must begin with '$'")
				}
				return self
			})
			.args("string", "function").use(function(type, callback){
				self.once(ele, type, callback)
				return self
			})
			.args().use(function(){
				console.warn("once function inputs improperly formatted")
				return self
			})

		public_method.hasClass = overload()
			.args({className: "string"}, "string").use(function(ele, c){
				return (ele.className.match(new RegExp("(^"+c+"$|\\s"+c+"\\s|^"+c+"\\s|\\s"+c+"$)")))? true : false
			})
			.args("string", "string").use(function(selector, c){
				if(selector[0] == "$"){
					return self.hasClass(self.element(selector), c)
				}
				else {
					console.warn("selector must begin with '$'")
					return false
				}
			})
			.args("string").use(function(c){
				return self.hasClass(ele, c)
			})
			.args().use(function(c){
				console.warn("malformed call")
				return false
			})

		public_method.addClass = overload()
			.args({scope:"object", className:"string"}, "string", "boolean").use(function(ele, c, multiple){
				if (ele.scope == self){
					if (multiple || !self.hasClass(ele, c)){
						ele.className += " " + c
						ele.className = ele.className.replace(/(^\s+|\s+$)/g, "")
					}
				}
				else {
					ele.scope.addClass(ele, c, multiple)
				}
				return self
			})
			.args({scope:"object", className:"string"}, "string").use(function(ele, c){
				self.addClass(ele, c, false)
				return self
			})
			.args({"0":"object", length:"number", forEach:"function"}, "string", "boolean").use(function(eles, c, multiple){
				eles.forEach(function(ele){
					self.addClass(ele, c, multiple)
				})
			})
			.args("string", "string", "boolean").use(function(selector, c, multiple){
				if(selector[0] == "$"){
					self.elements(selector).forEach( function(ele){
						self.addClass(ele, c, multiple)
					})
				}
				else {
					console.warn("selector must begin with '$'")
				}
				return self
			})
			.args({"0":"object", length:"number", forEach:"function"}, "string").use(function(eles, c){
				eles.forEach(function(ele){
					self.addClass(ele, c, false)
				})
			})
			.args({scope:"object", className:"string"}, "string").use(function(ele, c){
				self.addClass(ele, c, false)
				return self
			})
			.args("string", "string").use(function(selector, c){
				if(selector[0] == "$"){
					self.elements(selector).forEach( function(ele){
						self.addClass(ele, c, false)
					})
				}
				else {
					console.warn("selector must begin with '$'")
				}
				return self
			})
			.args("string", "boolean").use(function(c, multiple){
				self.addClass(ele, c, multiple)
				return self
			})
			.args("string").use(function(c){
				self.addClass(ele, c, false)
				return self
			})
			.args().use(function(){
				console.warn("addClass function inputs improperly formatted")
				return self
			})

		public_method.removeClass = overload()
			.args({scope:"object", className:"string"}, "string", "boolean").use(function(ele, c, multiple){
				if (ele.scope == self){
					var globalMatch = (multiple)? "g" : ""
					var matcher =  new RegExp("(^"+c+"$|\\s"+c+"\\s|^"+c+"\\s|\\s"+c+"$)", globalMatch)
					
					ele.className = ele.className
						.replace(matcher, " ")
						.replace(/(^\s+|\s+$)/g, "")
						.replace(/\s+/g, " ")
				}
				else {
					ele.scope.removeClass(ele, c, multiple)
				}
				return self
			})
			.args({scope:"object", className:"string"}, "string").use(function(ele, c){
				self.removeClass(ele, c, false)
				return self
			})
			.args({"0":"object", length:"number", forEach:"function"}, "string", "boolean").use(function(eles, c, multiple){
				eles.forEach(function(ele){
					self.removeClass(ele, c, multiple)
				})
			})
			.args("string", "string", "boolean").use(function(selector, c, multiple){
				if(selector[0] == "$"){
					self.elements(selector).forEach( function(ele){
						self.removeClass(ele, c, multiple)
					})
				}
				else {
					console.warn("selector must begin with '$'")
				}
				return self
			})
			.args({"0":"object", length:"number", forEach:"function"}, "string").use(function(eles, c){
				eles.forEach(function(ele){
					self.removeClass(ele, c, false)
				})
			})
			.args("string", "string").use(function(selector, c){
				if(selector[0] == "$"){
					self.elements(selector).forEach( function(ele){
						self.removeClass(ele, c, false)
					})
				}
				else {
					console.warn("selector must begin with '$'")
				}
				return self
			})
			.args("string", "boolean").use(function(c, multiple){
				self.removeClass(ele, c, multiple)
				return self
			})
			.args("string").use(function(c){
				self.removeClass(ele, c, false)
				return self
			})
			.args().use(function(){
				console.warn("removeClass function inputs improperly formatted")
				return self
			})

		public_method.attr = overload()
			.args({scope:"object", getAttribute:"function", setAttribute: "function"}, "string").use(function(ele, attribute, value){
				if (ele.scope == self){
					if (typeof value == "undefined") {
						return ele.getAttribute(attribute)
					}
					else {
						ele.setAttribute(attribute, value)
						return self
					}
				}
				else {
					if (typeof value == "undefined"){
						return ele.scope.attr(ele, attribute)
					}
					else {
						ele.scope.attr(ele, attribute, value)
						return self
					}
				}
			})
			.args({"0":"object", length:"number", forEach:"function"}, "string").use(function(eles, attribute, value){
				eles.forEach(function(ele){
					self.attr(ele, attribute, value)
				})
				return self
			})
			.args("string", "string").use(function(v1, v2, v3){
				if (v1[0] == "$"){ //v1 is selector
					var selector = v1,
						attribute = v2,
						value = v3

					if (typeof value == "undefined"){
						return self.attr(self.element(selector), attribute)
					}
					else {
						self.elements(selector).forEach( function(ele){
							self.attr(ele, attribute, value)
						})
						return self
					}
				}
				else{ // v1 is property name
					var attribute = v1,
						value = v2

					return self.attr(ele, attribute, value)
				}
			})
			.args("string").use(function(attribute, value){
				return self.attr(ele, attribute, value)
			})
			.args().use(function(){
				console.warn("attr function inputs improperly formatted")
				return self
			})


		public_method.css = overload()
			.args({scope: "object", style:"object"}, "string").use(function(ele, rule, value){
				if (ele.scope == self){
					if (typeof value != "undefined"){
						var elemStyles = self.attr(ele, "style") || "",
							replaceRule = new RegExp(rule + ".*(;|$)", "gi"),
							replaceWith = rule + ":" + value + ";"
							newRules = elemStyles.replace(replaceRule, replaceWith)

						if (newRules == elemStyles){
							self.attr(ele, "style", elemStyles + replaceWith)
						}
						else {
							self.attr(ele, "style", newRules)
						}
						return self
					}
					else {
						return getComputedStyle(ele).getPropertyValue(rule)
					}
				}
				else {
					if (value){
						ele.scope.css(ele, rule, value)
						return self
					}
					else {
						return ele.scope.css(ele, rule)
					}
				}
			})
			.args({"0":"object", length:"number", forEach:"function"}, "string").use(function(eles, rule, value){
				eles.forEach(function(ele){
					self.css(ele, rule, value)
				})
				return self
			})
			.args("string", "string").use(function(v1, v2, v3){
				if (v1[0] == "$"){
					var selector = v1,
						rule = v2,
						value = v3

					self.elements(selector).forEach(function(ele){
						self.css(ele, rule, value)
					})
					return self
				}
				else {
					var rule = v1,
						value = v2

					return self.css(ele, rule, value)
				}
			})
			.args("string").use(function(rule){
				return self.css(ele, rule)
			})
			.args().use(function(){
				console.warn("css function inputs improperly formatted")
				return self
			})

		public_method.data = overload()
			.args({scope:"object", dataset:"object"}, "string").use(function(ele, attribute, value){
				if (ele.scope == self){
					if (typeof value !== "undefined"){
						ele.dataset[attribute] = value
						return self
					}
					else {
						return ele.dataset[attribute]
					}
				}
				else {
					return ele.scope.data(ele, attribute)
				}
			})
			.args("string", "string").use(function(v1, v2, v3){
				if (v1[0] == "$"){ //v1 is selector
					var selector = v1,
						attribute = v2,
						value = v3

					if (typeof value == "undefined"){
						return self.data(self.element(selector), attribute)
					}
					else {
						self.elements(selector).forEach( function(ele){
							self.data(ele, attribute, value)
						})
						return self
					}
				}
				else{ // v1 is property name
					var attribute = v1,
						value = v2

					return self.data(ele, attribute, value)
				}
			})
			.args("string").use(function(attribute, value){
				return self.data(ele, attribute, value)
			})
			.args().use(function(){
				console.warn("data function inputs improperly formatted")
				return self
			})

		public_method.html = overload()
			.args({scope:"object", appendChild:"function"}, "string").use(function(ele, htmlString){
				if (ele.scope == self){
					self.children.forEach(function(subScope){
						subScope.unlink()
					})
					ele.innerHTML = htmlString
					ele.scope.include()
				}
				else {
					ele.scope.html(ele, htmlString)
				}
				return self
			})
			.args("string", "string").use(function(selector, htmlString){
				if (selector[0] == "$"){
					self.html(self.element(selector), htmlString)
				}
				return self
			})
			.args({scope:"object", appendChild:"function"}).use(function(ele){
				if (ele.scope == self) {
					return ele.innerHTML
				}
				else {
					return ele.scope.html(ele)
				}
			})
			.args("string").use(function(v){
				if (v[0] == "$"){
					var selector = v
					return self.html(self.element(selector))
				}
				else {
					var htmlString = v
					self.html(ele, htmlString)
					return self
				}
			})
			.args().use(function(v){
				return self.html(self.element())
			})

		// functions for dom manip end

		public_method.include = overload()
			.args({scope:"object", appendChild:"function"}, "object").use(function(ele, subEle){
				if (ele.scope == self && !subEle.scope){
					recursiveDefineScope(subEle, false)
					ele.appendChild(subEle)
				}<commit_msg>fixed error<commit_after>(function(context, eval){

	// --------------------------------------------------------
	// helper functions that do stuff
	// --------------------------------------------------------

	// lets you declare recursive anonamyous recursive functions
	function recursive(fn){
	    var bound = function(){
	        var inputs = Array.prototype.concat.call([bound], Array.prototype.splice.call(arguments, 0))
	        return fn.apply(null, inputs)
	    }
	    return bound
	}

	// modified method-overload v0.1.1
	var overload = (function(){var b=function(a,c){var d=!0;for(var e in c){"string"==typeof c[e]&&"!"===c[e][0]?typeof a[e]===c[e].substring(1)&&(d=!1):"object"==typeof a[e]&&"object"==typeof c[e]?d=b(a[e],c[e])&&d:typeof a[e]!==c[e]&&(d=!1)}return d};return function(){var a=this,c=arguments;1===arguments.length&&(c=arguments[0]);var d=[],e=function(){};e.use=e.args=function(){return e};var f=function(){for(var a in d){var c=d[a];if(b(arguments,c.m))return c.e.apply(this,arguments)}},g=function(){var g=arguments;return{use:function(h){return 0==g.length&&delete f.args,d.push({m:g,e:h}),c.length&&b(c,g)?(h.apply(a,c),e):f}}};return f.args=g,f}})();

	var converter = document.createElement("div")
    var instances = []

	// --------------------------------------------------------
	// The templater that does the heavy lifting kinda
	// --------------------------------------------------------
	var Scope = function(ele){
		// detect if new or just calling it
		var self = {}

		if (!ele){
			throw new Error("No element selected")
		}

		// set public methods into the prototype of this object.
		var public_method = {}
		Object.setPrototypeOf(self, public_method)

		// define public propertyies that can be gotten with .varname
		Object.defineProperty(public_method, "parent", {
			enumerable: false,
			configurable: false,
			get: function(){
				return ele.parentNode && ele.parentNode.scope
			}
		})

		Object.defineProperty(public_method, "children", {
			enumerable: false,
			configurable: false,
			get: function(){
				return instances.filter(function(scope){
                    return scope.parent == self
                })
			}
		})

		Object.defineProperty(public_method, "root", {
			enumerable: false,
			configurable: false,
			get: recursive(function(getParent, scope){
				scope = scope || self
				return (scope.parent)? getParent(scope.parent) : scope
			})
		})

		// set the "scope" property of every HTML element associated to self to provide a reference to self
		// most depended upon property in the framework
		var recursiveDefineScope = function(ele, recur){
			Object.defineProperty(ele, "scope", {
				enumerable: false,
				configurable: false,
				get: function(){
					return self
				}
			})

			if (recur !== false){
				Array.prototype.forEach.call(ele.querySelectorAll("*"), function(item){
					recursiveDefineScope(item, false)
				})
			}
		}
		recursiveDefineScope(ele)

		// begin dom manip functions

		var listeners = {}

		// public methods (kept in the prototype) for others to access
		public_method.on = overload()
			.args({scope:{on:"function"}, addEventListener: "function"}, "string", "function").use(function(ele, type, callback){
				if (ele.scope == self){
					//ele_on(ele, type, callback)
					var typeList = listeners[type] || (listeners[type] = []),
						repeat = false

					typeList.forEach(function(elfn){
						if (
							(elfn.fn == callback || elfn.fn.toString() == callback.toString()) &&
							(elfn.el == ele)
						){
							repeat = true
						}
					})

					if (!repeat){
						ele.addEventListener(type, callback)
						listeners[type].push({
							fn: callback,
							el: ele
						})
					}
					else {
						console.warn("listener is already registered")
					}
				}
				else {
					ele.scope.on(ele, type, callback)
				}
				return self
			})
			.args({"0":"object", length:"number", forEach:"function"}, "string", "function").use(function(eles, type, callback){
				eles.forEach(function(ele){
					self.on(ele, type, callback)
				})
				return self
			})
			.args("string", "string", "function").use(function(selector, type, callback){
				if(selector[0] == "$"){
					self.elements(selector).forEach( function(ele){
						self.on(ele, type, callback)
					})
				}
				else {
					console.warn("selector must begin with '$'")
				}
				return self
			})
			.args("string", "function").use(function(type, callback){
				self.on(ele, type, callback)
				return self
			})
			.args().use(function(){
				console.warn("on function inputs improperly formatted")
				return self
			})

		public_method.off = overload()
			.args({scope:{off:"function"}, addEventListener: "function"}, "string", "function").use(function(ele, type, callback){
				if (ele.scope == self){
					var typeList = listeners[type],
						found = false

					typeList && typeList.forEach(function(elfn, index){
						if (
							(elfn.fn == callback || elfn.fn.toString() == callback.toString()) &&
							elfn.el == ele
						){
							found = true
							ele.removeEventListener(type, elfn.fn)
							typeList.splice(index, 1)
						}
					})

					if (!found){
						console.warn("Listener is not currently registered")
					}
				}
				else {
					ele.scope.off(ele, type, callback)
				}
				return self
			})
			.args({"0":"object", length:"number", forEach:"function"}, "string", "function").use(function(eles, type, callback){
				eles.forEach(function(ele){
					self.off(ele, type, callback)
				})
			})
			.args("string", "string", "function").use(function(selector, type, callback){
				if(selector[0] == "$"){
					self.elements(selector).forEach( function(ele){
						self.off(ele, type, callback)
					})
				}
				else {
					console.warn("selector must begin with '$'")
				}
				return self
			})
			.args("string", "function").use(function(type, callback){
				self.off(ele, type, callback)
				return self
			})
			.args().use(function(){
				console.warn("off function inputs improperly formatted")
				return self
			})

		public_method.once = overload()
			.args({scope:{off:"function"}, addEventListener: "function"}, "string", "function").use(function(ele, type, callback){
				if (ele.scope == self){
					var cb = function(e){
						callback(e)
						self.off(ele, type, cb)
					}
					self.on(ele, type, cb)
				}
				else {
					ele.scope.once(ele, type, callback)
				}
				return self
			})
			.args({"0":"object", length:"number", forEach:"function"}, "string", "function").use(function(eles, type, callback){
				eles.forEach(function(ele){
					self.once(ele, type, callback)
				})
			})
			.args("string", "string", "function").use(function(selector, type, callback){
				if(selector[0] == "$"){
					self.elements(selector).forEach( function(ele){
						self.once(ele, type, callback)
					})
				}
				else {
					console.warn("selector must begin with '$'")
				}
				return self
			})
			.args("string", "function").use(function(type, callback){
				self.once(ele, type, callback)
				return self
			})
			.args().use(function(){
				console.warn("once function inputs improperly formatted")
				return self
			})

		public_method.hasClass = overload()
			.args({className: "string"}, "string").use(function(ele, c){
				return (ele.className.match(new RegExp("(^"+c+"$|\\s"+c+"\\s|^"+c+"\\s|\\s"+c+"$)")))? true : false
			})
			.args("string", "string").use(function(selector, c){
				if(selector[0] == "$"){
					return self.hasClass(self.element(selector), c)
				}
				else {
					console.warn("selector must begin with '$'")
					return false
				}
			})
			.args("string").use(function(c){
				return self.hasClass(ele, c)
			})
			.args().use(function(c){
				console.warn("malformed call")
				return false
			})

		public_method.addClass = overload()
			.args({scope:"object", className:"string"}, "string", "boolean").use(function(ele, c, multiple){
				if (ele.scope == self){
					if (multiple || !self.hasClass(ele, c)){
						ele.className += " " + c
						ele.className = ele.className.replace(/(^\s+|\s+$)/g, "")
					}
				}
				else {
					ele.scope.addClass(ele, c, multiple)
				}
				return self
			})
			.args({scope:"object", className:"string"}, "string").use(function(ele, c){
				self.addClass(ele, c, false)
				return self
			})
			.args({"0":"object", length:"number", forEach:"function"}, "string", "boolean").use(function(eles, c, multiple){
				eles.forEach(function(ele){
					self.addClass(ele, c, multiple)
				})
			})
			.args("string", "string", "boolean").use(function(selector, c, multiple){
				if(selector[0] == "$"){
					self.elements(selector).forEach( function(ele){
						self.addClass(ele, c, multiple)
					})
				}
				else {
					console.warn("selector must begin with '$'")
				}
				return self
			})
			.args({"0":"object", length:"number", forEach:"function"}, "string").use(function(eles, c){
				eles.forEach(function(ele){
					self.addClass(ele, c, false)
				})
			})
			.args({scope:"object", className:"string"}, "string").use(function(ele, c){
				self.addClass(ele, c, false)
				return self
			})
			.args("string", "string").use(function(selector, c){
				if(selector[0] == "$"){
					self.elements(selector).forEach( function(ele){
						self.addClass(ele, c, false)
					})
				}
				else {
					console.warn("selector must begin with '$'")
				}
				return self
			})
			.args("string", "boolean").use(function(c, multiple){
				self.addClass(ele, c, multiple)
				return self
			})
			.args("string").use(function(c){
				self.addClass(ele, c, false)
				return self
			})
			.args().use(function(){
				console.warn("addClass function inputs improperly formatted")
				return self
			})

		public_method.removeClass = overload()
			.args({scope:"object", className:"string"}, "string", "boolean").use(function(ele, c, multiple){
				if (ele.scope == self){
					var globalMatch = (multiple)? "g" : ""
					var matcher =  new RegExp("(^"+c+"$|\\s"+c+"\\s|^"+c+"\\s|\\s"+c+"$)", globalMatch)

					ele.className = ele.className
						.replace(matcher, " ")
						.replace(/(^\s+|\s+$)/g, "")
						.replace(/\s+/g, " ")
				}
				else {
					ele.scope.removeClass(ele, c, multiple)
				}
				return self
			})
			.args({scope:"object", className:"string"}, "string").use(function(ele, c){
				self.removeClass(ele, c, false)
				return self
			})
			.args({"0":"object", length:"number", forEach:"function"}, "string", "boolean").use(function(eles, c, multiple){
				eles.forEach(function(ele){
					self.removeClass(ele, c, multiple)
				})
			})
			.args("string", "string", "boolean").use(function(selector, c, multiple){
				if(selector[0] == "$"){
					self.elements(selector).forEach( function(ele){
						self.removeClass(ele, c, multiple)
					})
				}
				else {
					console.warn("selector must begin with '$'")
				}
				return self
			})
			.args({"0":"object", length:"number", forEach:"function"}, "string").use(function(eles, c){
				eles.forEach(function(ele){
					self.removeClass(ele, c, false)
				})
			})
			.args("string", "string").use(function(selector, c){
				if(selector[0] == "$"){
					self.elements(selector).forEach( function(ele){
						self.removeClass(ele, c, false)
					})
				}
				else {
					console.warn("selector must begin with '$'")
				}
				return self
			})
			.args("string", "boolean").use(function(c, multiple){
				self.removeClass(ele, c, multiple)
				return self
			})
			.args("string").use(function(c){
				self.removeClass(ele, c, false)
				return self
			})
			.args().use(function(){
				console.warn("removeClass function inputs improperly formatted")
				return self
			})

		public_method.attr = overload()
			.args({scope:"object", getAttribute:"function", setAttribute: "function"}, "string").use(function(ele, attribute, value){
				if (ele.scope == self){
					if (typeof value == "undefined") {
						return ele.getAttribute(attribute)
					}
					else {
						ele.setAttribute(attribute, value)
						return self
					}
				}
				else {
					if (typeof value == "undefined"){
						return ele.scope.attr(ele, attribute)
					}
					else {
						ele.scope.attr(ele, attribute, value)
						return self
					}
				}
			})
			.args({"0":"object", length:"number", forEach:"function"}, "string").use(function(eles, attribute, value){
				eles.forEach(function(ele){
					self.attr(ele, attribute, value)
				})
				return self
			})
			.args("string", "string").use(function(v1, v2, v3){
				if (v1[0] == "$"){ //v1 is selector
					var selector = v1,
						attribute = v2,
						value = v3

					if (typeof value == "undefined"){
						return self.attr(self.element(selector), attribute)
					}
					else {
						self.elements(selector).forEach( function(ele){
							self.attr(ele, attribute, value)
						})
						return self
					}
				}
				else{ // v1 is property name
					var attribute = v1,
						value = v2

					return self.attr(ele, attribute, value)
				}
			})
			.args("string").use(function(attribute, value){
				return self.attr(ele, attribute, value)
			})
			.args().use(function(){
				console.warn("attr function inputs improperly formatted")
				return self
			})


		public_method.css = overload()
			.args({scope: "object", style:"object"}, "string").use(function(ele, rule, value){
				if (ele.scope == self){
					if (typeof value != "undefined"){
						var elemStyles = self.attr(ele, "style") || "",
							replaceRule = new RegExp(rule + ".*(;|$)", "gi"),
							replaceWith = rule + ":" + value + ";"
							newRules = elemStyles.replace(replaceRule, replaceWith)

						if (newRules == elemStyles){
							self.attr(ele, "style", elemStyles + replaceWith)
						}
						else {
							self.attr(ele, "style", newRules)
						}
						return self
					}
					else {
						return getComputedStyle(ele).getPropertyValue(rule)
					}
				}
				else {
					if (value){
						ele.scope.css(ele, rule, value)
						return self
					}
					else {
						return ele.scope.css(ele, rule)
					}
				}
			})
			.args({"0":"object", length:"number", forEach:"function"}, "string").use(function(eles, rule, value){
				eles.forEach(function(ele){
					self.css(ele, rule, value)
				})
				return self
			})
			.args("string", "string").use(function(v1, v2, v3){
				if (v1[0] == "$"){
					var selector = v1,
						rule = v2,
						value = v3

					self.elements(selector).forEach(function(ele){
						self.css(ele, rule, value)
					})
					return self
				}
				else {
					var rule = v1,
						value = v2

					return self.css(ele, rule, value)
				}
			})
			.args("string").use(function(rule){
				return self.css(ele, rule)
			})
			.args().use(function(){
				console.warn("css function inputs improperly formatted")
				return self
			})

		public_method.data = overload()
			.args({scope:"object", dataset:"object"}, "string").use(function(ele, attribute, value){
				if (ele.scope == self){
					if (typeof value !== "undefined"){
						ele.dataset[attribute] = value
						return self
					}
					else {
						return ele.dataset[attribute]
					}
				}
				else {
					return ele.scope.data(ele, attribute)
				}
			})
			.args("string", "string").use(function(v1, v2, v3){
				if (v1[0] == "$"){ //v1 is selector
					var selector = v1,
						attribute = v2,
						value = v3

					if (typeof value == "undefined"){
						return self.data(self.element(selector), attribute)
					}
					else {
						self.elements(selector).forEach( function(ele){
							self.data(ele, attribute, value)
						})
						return self
					}
				}
				else{ // v1 is property name
					var attribute = v1,
						value = v2

					return self.data(ele, attribute, value)
				}
			})
			.args("string").use(function(attribute, value){
				return self.data(ele, attribute, value)
			})
			.args().use(function(){
				console.warn("data function inputs improperly formatted")
				return self
			})

		public_method.html = overload()
			.args({scope:"object", appendChild:"function"}, "string").use(function(ele, htmlString){
				if (ele.scope == self){
					self.children.forEach(function(subScope){
						subScope.unlink()
					})
					ele.innerHTML = htmlString
					ele.scope.include()
				}
				else {
					ele.scope.html(ele, htmlString)
				}
				return self
			})
			.args("string", "string").use(function(selector, htmlString){
				if (selector[0] == "$"){
					self.html(self.element(selector), htmlString)
				}
				return self
			})
			.args({scope:"object", appendChild:"function"}).use(function(ele){
				if (ele.scope == self) {
					return ele.innerHTML
				}
				else {
					return ele.scope.html(ele)
				}
			})
			.args("string").use(function(v){
				if (v[0] == "$"){
					var selector = v
					return self.html(self.element(selector))
				}
				else {
					var htmlString = v
					self.html(ele, htmlString)
					return self
				}
			})
			.args().use(function(v){
				return self.html(self.element())
			})

		// functions for dom manip end

		public_method.include = overload()
			.args({scope:"object", appendChild:"function"}, "object").use(function(ele, subEle){
				if (ele.scope == self && !subEle.scope){
					recursiveDefineScope(subEle)
					ele.appendChild(subEle)
				}
{'fraction_non_alphanumeric': 0.18760181521992086, 'fraction_numerical': 0.0038398882941587152, 'mean_word_length': 2.770234700592235, 'pattern_counts': {'":': 20, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1297861', 'n_tokens_mistral': 14435, 'n_tokens_neox': 10745, 'n_words': 2248}