Put all the element functions (e.g. $div(), $span()) in the global (window) namespace
163873
function(prefix) {
    jst.global          = true;
    jst.globalTagPrefix = prefix || jst.tagPrefix;
    for (let tag of jst.tags) {
      let name = jst.globalTagPrefix + tag;
      let g = typeof global !== 'undefined' ? global : window;
      g[name] = function() {
        return jst[name].apply(this, arguments);
      };
    }
  }
904449
function cleanUpElement(element) {
		const childNodes = element.childNodes;

		for (let i = 0; i < childNodes.length; i++) {
			const node = childNodes[i];

			let isVisible = node.nodeType === 1 ? window.getComputedStyle(node).display !== 'none' : true;
			if (isVisible && ['input', 'textarea', 'script', 'noscript', 'style', 'select', 'option', 'button'].indexOf(node.nodeName.toLowerCase()) >= 0) isVisible = false;

			if (!isVisible) {
				element.removeChild(node);
			} else {
				cleanUpElement(node);
			}
		}
	}
289625
def create_template_context(self, element, **kwargs):
        """"""
        context = dict(element=element, **kwargs)
        if self.global_context:
            context.update(**self.global_context)
        return context
485116
function(namespaces)
{
    var self        = this;
    this.namespaces = {
        default: {}
    };

    if (namespaces && util.isArray(namespaces)) {

        namespaces.forEach(function(namespace) {
            self.namespaces[namespace] = {};
        });
    }
}
998770
function(params) {
			$.extend(globalConfig, params || {});

			this.startAll(document.documentElement);

			this.fire('init');
			initialized = true;
		}
1059913
function(config) {
		
		var cfg = config;
		var self = this;
		var viewList = this.list();
		
		$(viewList).each(function(i, view) {
			
			if (!view.isInit) {
				
				if (view.dom !== 'undefined' && view.dom.main !== 'undefined') {
					
					if (i === 0 && self.cmp().placeholder()) {
						self.cmp().placeholder().replaceWith( view.dom.main );
					}
					
					if (i > 0) {
						viewList[ i - 1 ].dom.main.after( view.dom.main );
					}
					
				}
				
				view.isInit = true;
				
			}
			
		}).promise().done(function() {
			self.cmp().trigger('view.ready');
		});
		
	}
389079
function () {
                var msg = [], tp;
                msg.push('## ' + this.$classpath + ' ## ');
                for (var k in this) {
                    if (this.hasOwnProperty(k)) {
                        tp = typeof(this[k]);
                        if (tp == 'object' || tp == 'function')
                            msg.push(k += ':[' + tp + ']');
                        else if (tp == 'string')
                            msg.push(k += ':"' + this[k] + '"');
                        else
                            msg.push(k += ':' + this[k]);
                    }
                }
                Aria.$window.alert(msg.join('\n'));
                msg = null;
            }
1224648
private function SaveFunctionsToPHP()
    {
        $output_file = fopen(
            $this->definitions_path . "functions.php", 
            "w"
        );
        
        fwrite($output_file, "<?php\n\n");
        
        fwrite($output_file, "use Peg\Lib\Definitions\Element\FunctionElement;\n");
        fwrite($output_file, "use Peg\Lib\Definitions\Element\Overload;\n");
        fwrite($output_file, "use Peg\Lib\Definitions\Element\ReturnType;\n");
        fwrite($output_file, "use Peg\Lib\Definitions\Element\Parameter;\n");
        
        foreach($this->symbols->headers as $header)
        {
            if(!$header->HasFunctions())
                continue;
            
            foreach($header->namespaces as $namespace)
            {
                if(!$namespace->HasFunctions())
                    continue;
                
                foreach($namespace->functions as $function)
                {
                    $description = addslashes($function->description);
                    $namespace_name = addslashes($namespace->name);
                    
                    $output = "\n";
                    
                    $output .= '// Function ' . $function->name . "\n";
                    $output .= '$function = new FunctionElement(' . "\n";
                    $output .= '    "'.$function->name.'",' . "\n";
                    $output .= '    "'.$description.'"' . "\n";
                    $output .= ');' . "\n\n";
                    
                    foreach($function->overloads as $overload_index=>$overload)
                    {
                        $overload_description = addslashes($overload->description);
                        
                        $output .= '// Overload ' . $overload_index . "\n";
                        $output .= '$overload = new Overload(' . "\n";
                        $output .= '    "'.$overload_description.'"' . "\n";
                        $output .= ');' . "\n";
                        
                        $output .= '$overload->SetReturnType(' . "\n";
                        $output .= '    new ReturnType(' . "\n";
                        $output .= '        "'.$overload->return_type->original_type.'"' . "\n";
                        $output .= '    )' . "\n";
                        $output .= ');' . "\n";
                        
                        if($overload->HasParameters())
                        {
                            foreach($overload->parameters as $parameter)
                            {
                                $parameter_value = addslashes($parameter->default_value);
                                $parameter_description = addslashes($parameter->description);

                                $output .= '$parameter = new Parameter(' . "\n";
                                $output .= '    "'.$parameter->name.'",' . "\n";
                                $output .= '    "'.$parameter->original_type.'",' . "\n";
                                $output .= '    "'.$parameter_value.'",' . "\n";
                                $output .= '    "'.$parameter_description.'"' . "\n";
                                $output .= ');' . "\n";
                                
                                if($parameter->is_array)
                                {
                                    $output .= '$parameter->is_array = true;' . "\n";
                                }
                                
                                $output .= '$overload->AddParameter(' . "\n";
                                $output .= '    $parameter' . "\n";
                                $output .= ');' . "\n";
                            }
                        }
                        
                        $output .= '$function->AddOverload($overload);' . "\n\n";
                    }
                    
                    $output .= '$symbols->AddFunction(' . "\n";
                    $output .= '    $function,' . "\n";
                    $output .= '    "'.$header->name.'",' . "\n";
                    $output .= '    "'.$namespace_name.'"' . "\n";
                    $output .= ');' . "\n\n";
                    
                    fwrite($output_file, $output);
                }
            }
        }
        
        fclose($output_file);
    }
40207
def startElement (self, name, attrs):
                '''
                '''
                func = getattr(self, 'start_' + name, None)
                if func:
                        func(attrs)
716039
function Namespacer(settings, callback) {
      if (settings.namespace != null) {
        this.groupNamespace = settings.namespace;
      } else {
        callback('Error: \'namespace\' is not configured');
      }
      if (settings.templates != null) {
        this.templates = settings.templates;
      } else {
        callback('Error: \'templates\' is not configured');
      }
      if (settings.skiproot != null) {
        this.skiproot = settings.skiproot;
      }
      if ((this.groupNamespace != null) && (this.templates != null)) {
        this.callback = callback;
        this.namespaces = [];
        this.result = [];
        this.init();
      }
    }
221560
function modify( $tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$value, $namedParameters, $placement )
    {
        $phpname = $this->PHPNames[$operatorName];
        if ( $value !== null )
            $operand = $value;
        else
            $operand = $tpl->elementValue( $operatorParameters[0], $rootNamespace, $currentNamespace, $placement );
        $value = $phpname( $operand );
    }
881904
function() {
			var parent = document.body;
			this.$frameParent = parent;
			this.$$modalExclusions = this.$$modalExclusions || [];
			var range = document.createRange();
			range.selectNode(parent);
			var frameFragment = range.createContextualFragment(this.CONTAINERTEMPLATE);
			parent.appendChild(frameFragment);
			this.$frame = parent.lastChild;
			this.$frame.tabIndex = -1;
			this.$frame.style.outline = "none";
//			this.handle = lib.addAutoDismiss([this.$frame], this.hide.bind(this));
			if (this.title) {
				lib.$(".dialogTitleText", this.$frame).appendChild(document.createTextNode(this.title)); //$NON-NLS-0$
				this.$frame.setAttribute("aria-label", this.title); //$NON-NLS-0$
			}
			this.$close = lib.$(".closeDialog", this.$frame);//$NON-NLS-0$
			this.$close.setAttribute("aria-label", containerMessages["Close"]); //$NON-NLS-0$
			var self = this;
			this.$close.addEventListener("click", function(event) { //$NON-NLS-0$
				self.hide();
			}, false);
						
			this.$parent = lib.$(".dialogContent", this.$frame); //$NON-NLS-0$
			range = document.createRange();
			range.selectNode(this.$parent);
			var contentFragment = range.createContextualFragment(this.TEMPLATE);
			if (this.messages) {
				lib.processTextNodes(contentFragment, this.messages);
			}
			this.$parent.appendChild(contentFragment);
			this.$buttonContainer = lib.$(".dialogButtons", this.$frame); //$NON-NLS-0$
			this._makeButtons();
			
			// hook key handlers.  This must be done after _makeButtons so that the default callback (if any)
			// is established.
			this.$frame.addEventListener("keydown", function (e) { //$NON-NLS-0$
				if(e.keyCode === lib.KEY.ESCAPE) {
					self.hide();
				} else if (e.keyCode === lib.KEY.ENTER && (typeof self._defaultCallback) === "function") { //$NON-NLS-0$
					self._defaultCallback();
				}
			}, false);
			
			this._bindElements(this.$parent);
			if (typeof this._bindToDom === "function") { //$NON-NLS-0$
				this._bindToDom(this.$parent);
			}
		}
143271
function () {

        var oElement,
            oAnchor;

        if (!m_oMenuItemTemplate) {

            m_oMenuItemTemplate = document.createElement(_LI_LOWERCASE);
            m_oMenuItemTemplate.innerHTML = _ANCHOR_TEMPLATE;

        }

        oElement = m_oMenuItemTemplate.cloneNode(true);
        oElement.className = this.CSS_CLASS_NAME;

        oAnchor = oElement.firstChild;
        oAnchor.className = this.CSS_LABEL_CLASS_NAME;

        this.element = oElement;
        this._oAnchor = oAnchor;

    }
885482
function(ctx) {
		// Set classes for current status
		var node = ctx.node,
			tree = ctx.tree,
			opts = ctx.options,
//			nodeContainer = node[tree.nodeContainerAttrName],
			hasChildren = node.hasChildren(),
			isLastSib = node.isLastSibling(),
			aria = opts.aria,
//            $ariaElem = aria ? $(node[tree.ariaPropName]) : null,
			$ariaElem = $(node.span).find(".fancytree-title"),
			cn = opts._classNames,
			cnList = [],
			statusElem = node[tree.statusClassPropName];

		if( !statusElem ){
			// if this function is called for an unrendered node, ignore it (will be updated on nect render anyway)
			return;
		}
		// Build a list of class names that we will add to the node <span>
		cnList.push(cn.node);
		if( tree.activeNode === node ){
			cnList.push(cn.active);
//			$(">span.fancytree-title", statusElem).attr("tabindex", "0");
//			tree.$container.removeAttr("tabindex");
		// }else{
//			$(">span.fancytree-title", statusElem).removeAttr("tabindex");
//			tree.$container.attr("tabindex", "0");
		}
		if( tree.focusNode === node ){
			cnList.push(cn.focused);
			if(aria){
//              $(">span.fancytree-title", statusElem).attr("tabindex", "0");
//                $(">span.fancytree-title", statusElem).attr("tabindex", "-1");
				// TODO: is this the right element for this attribute?
				$ariaElem
					.attr("aria-activedescendant", true);
//					.attr("tabindex", "-1");
			}
		}else if(aria){
//			$(">span.fancytree-title", statusElem).attr("tabindex", "-1");
			$ariaElem
				.removeAttr("aria-activedescendant");
//				.removeAttr("tabindex");
		}
		if( node.expanded ){
			cnList.push(cn.expanded);
			if(aria){
				$ariaElem.attr("aria-expanded", true);
			}
		}else if(aria){
			$ariaElem.removeAttr("aria-expanded");
		}
		if( node.folder ){
			cnList.push(cn.folder);
		}
		if( hasChildren !== false ){
			cnList.push(cn.hasChildren);
		}
		// TODO: required?
		if( isLastSib ){
			cnList.push(cn.lastsib);
		}
		if( node.lazy && node.children == null ){
			cnList.push(cn.lazy);
		}
		if( node.partsel ){
			cnList.push(cn.partsel);
		}
		if( node._isLoading ){
			cnList.push(cn.loading);
		}
		if( node._error ){
			cnList.push(cn.error);
		}
		if( node.selected ){
			cnList.push(cn.selected);
			if(aria){
				$ariaElem.attr("aria-selected", true);
			}
		}else if(aria){
			$ariaElem.attr("aria-selected", false);
		}
		if( node.extraClasses ){
			cnList.push(node.extraClasses);
		}
		// IE6 doesn't correctly evaluate multiple class names,
		// so we create combined class names that can be used in the CSS
		if( hasChildren === false ){
			cnList.push(cn.combinedExpanderPrefix + "n" +
					(isLastSib ? "l" : "")
					);
		}else{
			cnList.push(cn.combinedExpanderPrefix +
					(node.expanded ? "e" : "c") +
					(node.lazy && node.children == null ? "d" : "") +
					(isLastSib ? "l" : "")
					);
		}
		cnList.push(cn.combinedIconPrefix +
				(node.expanded ? "e" : "c") +
				(node.folder ? "f" : "")
				);
//        node.span.className = cnList.join(" ");
		statusElem.className = cnList.join(" ");

		// TODO: we should not set this in the <span> tag also, if we set it here:
		// Maybe most (all) of the classes should be set in LI instead of SPAN?
		if(node.li){
			node.li.className = isLastSib ? cn.lastsib : "";
		}
	}
994148
function (statements, global) {
            var source = [];
            if (!global) {
                source.push('function(scopes) {');
            }
            source.push('var buffer = ""' + (global ? ',' : ';'));
            if (global) {
                source.push('config = this.config,' +
                    // current xtemplate engine
                    'engine = this, ' +
                    'utils = config.utils;');

                var natives = '',
                    c,
                    utils = XTemplateRuntime.utils;

                for (c in utils) {
                    natives += c + 'Util = utils["' + c + '"],';
                }

                if (natives) {
                    source.push('var ' + natives.slice(0, natives.length - 1) + ';');
                }
            }
            if (statements) {
                for (var i = 0, len = statements.length; i < len; i++) {
                    pushToArray(source, this[statements[i].type](statements[i]));
                }
            }
            source.push('return buffer;');
            if (!global) {
                source.push('}');
                return source;
            } else {
                return {
                    params: ['scopes', 'S', 'undefined'],
                    source: source
                };
            }
        }
341777
function GenerateFunction(
        \Peg\Lib\Definitions\Element\FunctionElement $function_object
    )
    {
        // Variables used by some template files.
        $authors = \Peg\Lib\Settings::GetAuthors();
        $contributors = \Peg\Lib\Settings::GetContributors();
        $extension = \Peg\Lib\Settings::GetExtensionName();
        $version = \Peg\Lib\Settings::GetVersion();

        $namespace_name = $function_object->namespace->name;

        if($namespace_name == "\\")
            $namespace_name = "";

        $namespace_name_cpp = str_replace(
            "\\",
            "::",
            $namespace_name
        );

        $namespace_name_var = str_replace(
            "\\",
            "_",
            $namespace_name
        );

        $function_name = $function_object->name;
        $function_arginfo = $this->GenerateArgInfo($function_object);
        $overloads_count = count($function_object->overloads);

        $function_content = "";

        $parameters_code = "";
        $parse_code = "";
        $return_code = "";

        $proto_header = $this->GetProtoHeader($function_object);
        $proto_footer = $this->GetProtoFooter();

        // Get header of function
        ob_start();
            include($this->GetTemplatePath(
                $function_name,
                "function",
                "head",
                "functions",
                "",
                $namespace_name
            ));
            $function_content .= ob_get_contents();
        ob_end_clean();

         // Parameters declaration
        foreach($function_object->overloads as $overload=>$overload_object)
        {
            // Overload parameters declaration header
            ob_start();
                include($this->GetTemplatePath(
                    $function_name,
                    "overloads",
                    "parameters_header",
                    "helpers",
                    "overload",
                    $namespace_name
                ));
                $parameters_code .= ob_get_contents();
            ob_end_clean();

            foreach($overload_object->parameters as $parameter_name=>$parameter_object)
            {
                // Overload parameter declarations
                ob_start();
                    include($this->GetParameterTemplate($parameter_object, $namespace_name, "declare"));
                    $parameters_code .= ob_get_contents();
                ob_end_clean();
            }

            // Overload parameters declaration footer
            ob_start();
                include($this->GetTemplatePath(
                    $function_name,
                    "overloads",
                    "parameters_footer",
                    "helpers",
                    "overload",
                    $namespace_name
                ));
                $parameters_code .= ob_get_contents();
            ob_end_clean();
        }

        // Parse parameters code
        foreach($function_object->overloads as $overload=>$overload_object)
        {
            $parameters_count = $overload_object->GetParametersCount();
            $required_parameters = $overload_object->GetRequiredParametersCount();

            // Overload parse header
            ob_start();
                include($this->GetTemplatePath(
                    $function_name,
                    "overloads",
                    "parse_header",
                    "helpers",
                    "overload",
                    $namespace_name
                ));
                $parse_code .= ob_get_contents();
            ob_end_clean();

            $parse_string = "";
            $parameters_optional = false;
            $parse_parameters = "";

            $parse_references = "";
            $parse_string_ref = "";
            $parse_reference = "";
            $references_found = false;

            $object_validate_code = "";

            $parameter_index = 0;
            foreach($overload_object->parameters as $parameter_name=>$parameter_object)
            {
                if($parameter_object->default_value && !$parameters_optional)
                {
                    $parse_string .= "|";
                    $parse_string_ref = "|";
                    $parameters_optional = true;
                }

                ob_start();
                    include($this->GetParameterTemplate($parameter_object, $namespace_name, "parse_string"));
                    $parse_string .= ob_get_contents();
                ob_end_clean();

                ob_start();
                    include($this->GetParameterTemplate($parameter_object, $namespace_name, "parse"));
                    $parse_parameters .= ob_get_contents();
                ob_end_clean();

                if(!$parameter_object->is_const && $parameter_object->is_reference)
                    $references_found = true;

                ob_start();
                    include($this->GetParameterTemplate($parameter_object, $namespace_name, "parse_string_ref"));
                    $parse_string_ref .= ob_get_contents();
                ob_end_clean();

                ob_start();
                    include($this->GetParameterTemplate($parameter_object, $namespace_name, "parse_reference"));
                    $parse_reference .= ob_get_contents();
                ob_end_clean();

                if(
                    $this->symbols->GetStandardType($parameter_object)
                    ==
                    \Peg\Lib\Definitions\StandardType::OBJECT
                )
                {
                    ob_start();
                        include($this->GetParameterTemplate($parameter_object, $namespace_name, "object_validate"));
                        $object_validate_code .= $this->Indent(ob_get_contents(), 4);
                    ob_end_clean();
                }

                $parameter_index++;
            }

            // No parameters to parse
            if($required_parameters == 0 && $parameters_count < 1)
            {
                // Overload no parse body
                ob_start();
                    include($this->GetTemplatePath(
                        $function_name,
                        "overloads",
                        "parse_no_body",
                        "helpers",
                        "overload",
                        $namespace_name
                    ));
                    $parse_code .= $this->Indent(ob_get_contents(), 4);
                ob_end_clean();
            }
            // There is parameters to parse
            else
            {
                if($references_found)
                {
                    // Overload parse references
                    ob_start();
                        include($this->GetTemplatePath(
                            $function_name,
                            "overloads",
                            "parse_references",
                            "helpers",
                            "overload"
                        ));
                        $parse_references .= $this->Indent(ob_get_contents(), 4);
                    ob_end_clean();
                }

                // Overload parse body
                ob_start();
                    include($this->GetTemplatePath(
                        $function_name,
                        "overloads",
                        "parse_body",
                        "helpers",
                        "overload",
                        $namespace_name
                    ));
                    $parse_code .= $this->Indent(ob_get_contents(), 4);
                ob_end_clean();
            }

            // Overload parse footer
            ob_start();
                include($this->GetTemplatePath(
                    $function_name,
                    "overloads",
                    "parse_footer",
                    "helpers",
                    "overload",
                    $namespace_name
                ));
                $parse_code .= ob_get_contents();
            ob_end_clean();
        }

        // Return code
        foreach($function_object->overloads as $overload=>$overload_object)
        {
            $parameters_count = $overload_object->GetParametersCount();
            $required_parameters = $overload_object->GetRequiredParametersCount();

            $call_declare_code = "";

            // Optional declarations before proceeding to call an overload
            $parameter_index = 0;
            foreach($overload_object->parameters as $parameter_name=>$parameter_object)
            {
                ob_start();
                    include($this->GetParameterTemplate($parameter_object, "", "call_declare"));
                    $call_declare_code .= $this->Indent(ob_get_contents(), 4);
                ob_end_clean();

                $parameter_index++;
            }

            // Generate the overload return heading
            ob_start();
                include($this->GetTemplatePath(
                    $function_name,
                    "overloads",
                    "return_header",
                    "helpers",
                    "overload",
                    $namespace_name
                ));
                $return_code .= ob_get_contents();
            ob_end_clean();

            // Variables used by after call object template.
            $class_name = "";
            $is_constructor = false;

            for(
                $required_parameters;
                $required_parameters<=$parameters_count;
                $required_parameters++
            )
            {
                // Overload return body header
                ob_start();
                    include($this->GetTemplatePath(
                        $function_name,
                        "overloads",
                        "return_body_header",
                        "helpers",
                        "overload",
                        $namespace_name
                    ));
                    $return_code .= $this->Indent(ob_get_contents(), 8);
                ob_end_clean();

                $parameter_index = 0;
                $parameters_string = "";
                $after_call = "";

                foreach($overload_object->parameters as $parameter_name=>$parameter_object)
                {
                    if($parameter_index<$required_parameters)
                    {
                        ob_start();
                            include($this->GetParameterTemplate($parameter_object, "", "before_call"));
                            $before_call = $this->Indent(ob_get_contents(), 12);
                        ob_end_clean();

                        if(trim($before_call))
                            $return_code .= $before_call;

                        ob_start();
                            include($this->GetParameterTemplate($parameter_object, "", "call"));
                            $parameters_string .= ob_get_contents();
                        ob_end_clean();

                        ob_start();
                            include($this->GetParameterTemplate($parameter_object, "", "after_call"));
                            $after_call .= ob_get_contents();
                        ob_end_clean();
                    }
                    else
                    {
                        break;
                    }

                    $parameter_index++;
                }

                ob_start();
                    include($this->GetReturnTemplate($overload_object->return_type, "", "function"));
                    $return_code .= $this->Indent(ob_get_contents(), 12);
                ob_end_clean();

                $return_code .= $after_call;

                // Overload return body footer
                ob_start();
                    include($this->GetTemplatePath(
                        $function_name,
                        "overloads",
                        "return_body_footer",
                        "helpers",
                        "overload",
                        $namespace_name
                    ));
                    $return_code .= $this->Indent(ob_get_contents(), 8);
                ob_end_clean();
            }

            // Generate the overload return footer
            ob_start();
                include($this->GetTemplatePath(
                    $function_name,
                    "overloads",
                    "return_footer",
                    "helpers",
                    "overload",
                    $namespace_name
                ));
                $return_code .= ob_get_contents();
            ob_end_clean();
        }

        // Get body of function
        ob_start();
            include($this->GetTemplatePath(
                $function_name,
                "function",
                "body",
                "functions",
                "",
                $namespace_name
            ));
            $function_content .= $this->Indent(ob_get_contents(), 4);
        ob_end_clean();

        // Get footer of function
        ob_start();
            include($this->GetTemplatePath(
                $function_name,
                "function",
                "footer",
                "functions",
                "",
                $namespace_name
            ));
            $function_content .= ob_get_contents();
        ob_end_clean();

        return $function_content;
    }
1280876
function bind()
        {
          bind.injectPrototypes(Node,'Node');
          bind.injectPrototypes(Element,'Element');
          bind.injectPrototypes(HTMLElement,'HTMLElement');
          bind.injectPrototypes(HTMLInputElement,'HTMLInputElement');
          bind.injectPrototypes(HTMLTextAreaElement,'HTMLTextAreaElement');
          bind.injectPrototypes(Document,'Document');

          var __set = _set,
              __update = _update;

          function hasInput(attrListeners)
          {
            var attrs = ['value','checked'],
                _localListeners = attrListeners,
                _localAttr = _localListeners._attrListeners,
                _localUpdateAttr = _localListeners._attrUpdateListeners,
                _localParentAttr = _localListeners._parentAttrListeners,
                _localParentUpdateAttr = _localListeners._parentAttrUpdateListeners,
                has = false;

            if(_attrListeners[_all] !== undefined || _attrUpdateListeners[_all] !== undefined)
            {
              has = true;
            }
            if(has !== true && _localAttr[_all] !== undefined ||
               _localUpdateAttr[_all] !== undefined ||
               _localParentAttr[_all] !== undefined ||
               _localParentUpdateAttr[_all] !== undefined)
            {
              has = true;
            }
            if(has !== true)
            {
              for(var x=0;x<attrs.length;x++)
              {
                if(_attrListeners[attrs[x]] !== undefined ||
                   _attrUpdateListeners[attrs[x]] !== undefined ||
                   _localAttr[attrs[x]] !== undefined ||
                   _localUpdateAttr[attrs[x]] !== undefined ||
                   _localParentAttr[attrs[x]] !== undefined ||
                   _localParentUpdateAttr[attrs[x]] !== undefined)
                  {
                    has = true;
                    break;
                  }
              }
            }
            return has;
          }

          function getStyles(arr,styles)
          {
            var x,
                _arr = arr,
                _styles = styles,
                len = styles.length;
            for(x=0;x<len;x++)
            {
              if(_arr.indexOf(_styles[x]) === -1)
              {
                _arr.push(_styles[x]);
              }
            }
            return _arr;
          }

          function hasStyle(attrListeners)
          {
            var _globalStyle = Object.keys(_styleListeners),
                _globalStyleUpdate = Object.keys(_styleUpdateListeners),
                _localListeners = attrListeners,
                _localStyle = Object.keys(_localListeners._styleListeners),
                _localUpdateStyle = Object.keys(_localListeners._styleUpdateListeners),
                _localParentStyle = Object.keys(_localListeners._parentStyleListeners),
                _localParentUpdateStyle = Object.keys(_localListeners._parentStyleUpdateListeners),
                has = [];

            if(_globalStyle.length !== 0 ||
               _globalStyleUpdate.length !== 0)
            {
              has = getStyles(has,_globalStyle);
              has = getStyles(has,_globalStyleUpdate);
            }
            if(has.length !== 0 && _localParentStyle.length !== 0 ||
               _localParentUpdateStyle.length !== 0)
            {
              has = getStyles(has,_localParentStyle);
              has = getStyles(has,_localParentUpdateStyle);
            }
            if(has.indexOf(_all) !== -1) has = _allStyles;
            return has;
          }

          function copyListeners(listeners,copyTo)
          {
            var listenerProps = Object.keys(listeners),
                _currProp,
                _currListener;
            for(var x=0,len=listenerProps.length;x<len;x++)
            {
              _currProp = listenerProps[x];
              if(copyTo[_currProp] === undefined)
              {
                copyTo[_currProp] = listeners[_currProp].slice();
              }
              else
              {
                for(var i=0,lenI=listeners[_currProp].length;i<lenI;i++)
                {
                  _currListener = listeners[_currProp][i];
                  copyTo[_currProp].push(_currListener);
                }
              }
            }
          }

          function reSync(e)
          {
            if(e.target.nodeType !== 3 && e.target.nodeType !== 8)
            {
              var attrListeners = e.target.attrListeners(),
                  _hasInput = hasInput(attrListeners),
                  _hasStyle = hasStyle(attrListeners),
                  _hasStyleLen = _hasStyle.length,
                  _parentAttr,
                  _parentAttrUpdate,
                  _parentStyle,
                  _parentStyleUpdate,
                  _listeners,
                  nodes = [],
                  len,
                  outer = ((e.attr === 'outerHTML' || e.attr === 'outerText') ? e.attr : undefined),
                  target = e.target

              if(outer !== undefined)
              {
                e.attr = 'appendChild',
                e.arguments = [e.target];
                e.target = e.target.parentElement;
              }

              if(_hasInput)
              {
                if(e.attr === 'appendChild' && e.arguments[0].nodeType !== 3 && e.arguments[0].nodeType !== 8)
                {
                  nodes = Array.prototype.slice.call(e.arguments[0].querySelectorAll('input,textarea'));
                  if(e.arguments[0].tagName === 'INPUT' || e.arguments[0].tagName === 'TEXTAREA')
                  {
                    nodes.unshift(e.arguments[0])
                  }
                }
                else
                {
                  nodes = Array.prototype.slice.call(e.target.querySelectorAll('input,textarea'));
                }
                len = nodes.length;
                for(var x=0;x<len;x++)
                {
                  if(nodes[x].addInputBinding !== undefined) nodes[x].addInputBinding();
                  if(nodes[x].addInputBoxBinding !== undefined) nodes[x].addInputBoxBinding();
                }
              }

              if(e.attr === 'appendChild' && e.arguments[0].nodeName !== '#text' && e.arguments[0].nodeName !== '#comment')
              {
                nodes = Array.prototype.slice.call(e.arguments[0].querySelectorAll('*'));
                nodes.unshift(e.arguments[0]);
                _parentAttr = e.target.__kb._parentAttrListeners;
                _parentAttrUpdate = e.target.__kb._parentAttrUpdateListeners;
                _parentStyle = e.target.__kb._parentStyleListeners;
                _parentStyleUpdate = e.target.__kb._parentStyleUpdateListeners;
              }
              else
              {
                nodes = Array.prototype.slice.call(e.target.querySelectorAll('*'));
                _parentAttr = e.target.__kb._parentAttrListeners;
                _parentAttrUpdate = e.target.__kb._parentAttrUpdateListeners;
                _parentStyle = e.target.__kb._parentStyleListeners;
                _parentStyleUpdate = e.target.__kb._parentStyleUpdateListeners;
              }
              len = nodes.length;

                for(var x=0;x<len;x++)
                {
                  if(_hasStyleLen !== 0)
                  {
                    for(var i=0;i<_hasStyleLen;i++)
                    {
                      bind.injectStyleProperty(nodes[x],_hasStyle[i]);
                    }
                  }
                  _listeners = nodes[x].attrListeners();

                  copyListeners(_parentAttr,_listeners._parentAttrListeners);
                  copyListeners(_parentAttrUpdate,_listeners._parentAttrUpdateListeners);
                  copyListeners(_parentStyle,_listeners._parentStyleListeners);
                  copyListeners(_parentStyleUpdate,_listeners._parentStyleUpdateListeners);
                }

              if(outer !== undefined)
              {
                e.attr = outer;
                e.target = target;
                e.arguments = [];
              }
            }
          }

          function checkAttr(e)
          {
            var oldAttr = e.target.attributes[e.arguments[0]],
                old = (oldAttr !== undefined ? oldAttr.value : ""),
                val = (e.attr === 'setAttribute' ? e.arguments[1] : "");
              if(!__set(e.target,e.arguments[0],val,old,[val])){
                e.preventDefault();
              }
          }

          function checkAttrUpdate(e)
          {
            var oldAttr = e.target.attributes[e.arguments[0]],
                old = (oldAttr !== undefined ? oldAttr.value : ""),
                val = (e.attr === 'setAttribute' ? e.arguments[1] : "");
                __update(e.target,e.arguments[0],val,old,[val]);
          }

          //for keeping binds with inputs
          bind.addAttrUpdateListener('appendChild',reSync);
          bind.addAttrUpdateListener('removeChild',reSync);
          bind.addAttrUpdateListener('innerHTML',reSync);
          bind.addAttrUpdateListener('outerHTML',reSync);
          bind.addAttrUpdateListener('innerText',reSync);
          bind.addAttrUpdateListener('outerText',reSync);
          bind.addAttrUpdateListener('textContent',reSync);

          //allows for html attribute changes to be listened to just like properties
          bind.addAttrListener('setAttribute',checkAttr);
          bind.addAttrListener('removeAttribute',checkAttr);

          bind.addAttrUpdateListener('setAttribute',checkAttrUpdate);
          bind.addAttrUpdateListener('removeAttribute',checkAttrUpdate);

          return bind;
        }