Ensure that the View has a DOM element to render into. If `this.el` is a string, pass it through `$()`, take the first matching element, and re-assign it to `el`. Otherwise, create an element from the `id`, `className` and `tagName` properties.
7138
function() {
	      if (!this.el) {
	        var attrs = langx.mixin({}, langx.result(this, 'attributes'));
	        if (this.id) attrs.id = langx.result(this, 'id');
	        if (this.className) attrs['class'] = langx.result(this, 'className');
	        this.setElement(this._createElement(langx.result(this, 'tagName'),attrs));
	        this._setAttributes(attrs);
	      } else {
	        this.setElement(langx.result(this, 'el'));
	      }
	    }
1373937
function(el) {
	// manually create a copy of the element
	var new_el = document.createElementNS(el.namespaceURI, el.nodeName);
	$.each(el.attributes, function(i, attr) {
		if (attr.localName != '-moz-math-font-style') {
			new_el.setAttributeNS(attr.namespaceURI, attr.nodeName, attr.nodeValue);
		}
	});
	// set the copied element's new id
	new_el.removeAttribute("id");
	new_el.id = getNextId();
	
	// Opera's "d" value needs to be reset for Opera/Win/non-EN
	// Also needed for webkit (else does not keep curved segments on clone)
	if (svgedit.browser.isWebkit() && el.nodeName == 'path') {
		var fixed_d = pathActions.convertPath(el);
		new_el.setAttribute('d', fixed_d);
	}

	// now create copies of all children
	$.each(el.childNodes, function(i, child) {
		switch(child.nodeType) {
			case 1: // element node
				new_el.appendChild(copyElem(child));
				break;
			case 3: // text node
				new_el.textContent = child.nodeValue;
				break;
			default:
				break;
		}
	});
	
	if ($(el).data('gsvg')) {
		$(new_el).data('gsvg', new_el.firstChild);
	} else if ($(el).data('symbol')) {
		var ref = $(el).data('symbol');
		$(new_el).data('ref', ref).data('symbol', ref);
	} else if (new_el.tagName == 'image') {
		preventClickDefault(new_el);
	}
	return new_el;
}
1348343
function ensureDOMElement (input) {
  let domElement = null
  let tmp = null
  if (input instanceof Element) {
    return input
  } else if ('string' == typeof input) {
    tmp = document.createElement('div')
    tmp.innerHTML = input
    domElement = tmp.innerHTML.length ? tmp.children[0] : new Template(input)
  } else {
    domElement = document.createElement('div')
  }
  return domElement
}
174534
function(el, componentTagData) {
			// Save arguments so if this component gets re-inserted,
			// we can setup again.
			this._initialArgs = [el,componentTagData];

			var component = this;

			var options = {
				helpers: {},
				tags: {}
			};

			// #### Clean up arguments

			// If componentTagData isn’t defined, check for el and use it if it’s defined;
			// otherwise, an empty object is needed for componentTagData.
			if (componentTagData === undefined) {
				if (el === undefined) {
					componentTagData = {};
				} else {
					componentTagData = el;
					el = undefined;
				}
			}

			// Create an element if it doesn’t exist and make it available outside of this
			if (el === undefined) {
				el = DOCUMENT().createElement(this.tag);
				el[createdByCanComponentSymbol] = true;
			}
			this.element = el;

			if(componentTagData.initializeBindings === false && !this._skippedSetup) {
				// Temporary, will be overridden.
				this._skippedSetup = this._torndown = true;
				this.viewModel = Object.create(null);
				return;
			}

			var componentContent = componentTagData.content;
			if (componentContent !== undefined) {
				// Check if it’s already a renderer function or
				// a string that needs to be parsed by stache
				if (typeof componentContent === "function") {
					componentTagData.subtemplate = componentContent;
				} else if (typeof componentContent === "string") {
					componentTagData.subtemplate = stache(componentContent);
				}
			}

			var componentScope = componentTagData.scope;
			if (componentScope !== undefined && componentScope instanceof Scope === false) {
				componentTagData.scope = new Scope(componentScope);
			}

			// Hook up any templates with which the component was instantiated
			var componentTemplates = componentTagData.templates;
			if (componentTemplates !== undefined) {
				canReflect.eachKey(componentTemplates, function(template, name) {
					// Check if it’s a string that needs to be parsed by stache
					if (typeof template === "string") {
						var debugName = name + " template";
						componentTemplates[name] = stache(debugName, template);
					}
				});
			}

			// #### Setup ViewModel
			var viewModel;
			var initialViewModelData = {};

			var preventDataBindings = domData.get(el, "preventDataBindings");

			var teardownBindings;
			if (preventDataBindings) {
				viewModel = el[viewModelSymbol];
			} else {
				// Set up the bindings
				var setupFn;
				if (componentTagData.setupBindings) {
					setupFn = function(el, componentTagData, callback, initialViewModelData){
						return componentTagData.setupBindings(el, callback, initialViewModelData);
					};
				} else if (componentTagData.viewModel) {
					// Component is being instantiated with a viewModel
					setupFn = getSetupFunctionForComponentVM(componentTagData.viewModel);
				} else {
					setupFn = stacheBindings.behaviors.viewModel;
				}
				teardownBindings = setupFn(el, componentTagData, function(initialViewModelData) {

					var ViewModel = component.constructor.ViewModel,
						viewModelHandler = component.constructor.viewModelHandler,
						viewModelInstance = component.constructor.viewModelInstance;

					if(viewModelHandler) {
						var scopeResult = viewModelHandler.call(component, initialViewModelData, componentTagData.scope, el);
						if (canReflect.isObservableLike(scopeResult) && canReflect.isMapLike(scopeResult) ) {
							// If the function returns a can.Map, use that as the viewModel
							viewModelInstance = scopeResult;
						} else if (canReflect.isObservableLike(scopeResult.prototype) && canReflect.isMapLike(scopeResult.prototype)) {
							// If `scopeResult` is of a `can.Map` type, use it to wrap the `initialViewModelData`
							ViewModel = scopeResult;
						} else {
							// Otherwise extend `SimpleMap` with the `scopeResult` and initialize it with the `initialViewModelData`
							ViewModel = SimpleMap.extend(scopeResult);
						}
					}

					if(ViewModel) {
						viewModelInstance = new ViewModel(initialViewModelData);
					}
					viewModel = viewModelInstance;
					return viewModelInstance;
				}, initialViewModelData);
			}

			// Set `viewModel` to `this.viewModel` and set it to the element's `data` object as a `viewModel` property
			this.viewModel = viewModel;
			el[viewModelSymbol] = viewModel;
			el.viewModel = viewModel;
			domData.set(el, "preventDataBindings", true);

			// an array of teardown stuff that should happen when the element is removed
			var teardownFunctions = [];
			var callTeardownFunctions = function() {
					for (var i = 0, len = teardownFunctions.length; i < len; i++) {
						teardownFunctions[i]();
					}
				};

			// #### Helpers
			// TODO: remove in next release
			// Setup helpers to callback with `this` as the component
			if(this.helpers !== undefined) {
				canReflect.eachKey(this.helpers, function(val, prop) {
					if (typeof val === "function") {
						options.helpers[prop] = val.bind(viewModel);
					}
				});
			}


			// #### `events` control
			// TODO: remove in next release
			// Create a control to listen to events
			if(this.constructor.Control) {
				this._control = new this.constructor.Control(el, {
					// Pass the viewModel to the control so we can listen to it's changes from the controller.
					scope: this.viewModel,
					viewModel: this.viewModel,
					destroy: callTeardownFunctions
				});
			} else {
				var removalDisposal = domMutate.onNodeRemoval(el, function () {
					var doc = el.ownerDocument;
					var rootNode = doc.contains ? doc : doc.documentElement;
					if (!rootNode || !rootNode.contains(el)) {
						if(removalDisposal) {
							nodeRemoved = true;
							removalDisposal();
							callTeardownFunctions();
							removalDisposal = null;
							callTeardownFunctions = null;
						}
					}
				});
			}

			// #### Rendering

			var leakScope = {
				toLightContent: this.leakScope === true,
				intoShadowContent: this.leakScope === true
			};

			var hasShadowView = !!(this.constructor.view);
			var shadowFragment;

			// Get what we should render between the component tags
			// and the data for it.
			var betweenTagsView;
			var betweenTagsTagData;
			if( hasShadowView ) {
				var shadowTagData;
				if (leakScope.intoShadowContent) {
					// Give access to the component's data and the VM
					shadowTagData = {
						scope: componentTagData.scope.add(this.viewModel, { viewModel: true }),
						options: options
					};

				} else { // lexical
					// only give access to the VM
					shadowTagData = {
						scope: new Scope(this.viewModel, null, { viewModel: true }),
						options: options
					};
				}

				// Add a hookup for each <can-slot>
				options.tags['can-slot'] = makeReplacementTagCallback('can-slot', componentTagData, shadowTagData, leakScope, function(el) {
					var templates = componentTagData.templates;
					if (templates) {// This is undefined if the component is <self-closing/>
						return templates[el.getAttribute("name")];
					}
				});

				// Add a hookup for <content>
				options.tags.content = makeReplacementTagCallback('content',  componentTagData, shadowTagData, leakScope, function() {
					return componentTagData.subtemplate;
				});

				betweenTagsView = this.constructor.view;
				betweenTagsTagData = shadowTagData;
			}
			else {
				// No shadow template.
				// Render light template with viewModel on top
				var lightTemplateTagData = {
					scope: componentTagData.scope.add(this.viewModel, {
						viewModel: true
					}),
					options: options
				};
				betweenTagsTagData = lightTemplateTagData;
				betweenTagsView = componentTagData.subtemplate || el.ownerDocument.createDocumentFragment.bind(el.ownerDocument);
			}
			var viewModelDisconnectedCallback,
				insertionDisposal,
				componentInPage,
				nodeRemoved;

			// Keep a nodeList so we can kill any directly nested nodeLists within this component
			var nodeList = nodeLists.register([], function() {
				if(removalDisposal && !nodeRemoved) {
					removalDisposal();
					callTeardownFunctions();
					removalDisposal = null;
					callTeardownFunctions = null;
				}
				component._torndown = true;
				domEvents.dispatch(el, "beforeremove", false);
				if(teardownBindings) {
					teardownBindings();
				}
				if(viewModelDisconnectedCallback) {
					viewModelDisconnectedCallback(el);
				} else if(typeof viewModel.stopListening === "function"){
					viewModel.stopListening();
				}
				if(insertionDisposal) {
					insertionDisposal();
					insertionDisposal = null;
				}
			}, componentTagData.parentNodeList || true, false);
			nodeList.expression = "<" + this.tag + ">";
			teardownFunctions.push(function() {
				nodeLists.unregister(nodeList);
			});
			this.nodeList = nodeList;

			shadowFragment = betweenTagsView(betweenTagsTagData.scope, betweenTagsTagData.options, nodeList);

			// TODO: afterRender

			// Append the resulting document fragment to the element
			domMutateNode.appendChild.call(el, shadowFragment);

			// update the nodeList with the new children so the mapping gets applied
			nodeLists.update(nodeList, getChildNodes(el));

			// Call connectedCallback
			if(viewModel && viewModel.connectedCallback) {
				var body = DOCUMENT().body;
				componentInPage = body && body.contains(el);

				if(componentInPage) {
					viewModelDisconnectedCallback = viewModel.connectedCallback(el);
				} else {
					insertionDisposal = domMutate.onNodeInsertion(el, function () {
						insertionDisposal();
						insertionDisposal = null;
						viewModelDisconnectedCallback = viewModel.connectedCallback(el);
					});
				}

			}
			component._torndown = false;
		}
793862
function DOMViewControllerMixin(view) {

  var _this = this;

  function attachEvents() {

    // Events can be an object or a function that returns an object
    var events;
    if (isFunction(view.events)) {
      events = view.events();
    } else {
      events = view.events || {};
    }

    for (var key in events) {
      if (events.hasOwnProperty(key)) {
        var fn;

        (function () {
          var firstSpaceIndex = key.indexOf(' ');
          var type = undefined;
          var selector = undefined;
          // Event on root element
          if (firstSpaceIndex === -1) {
            type = key;
          } else {
            type = key.substr(0, firstSpaceIndex);
            selector = key.substr(firstSpaceIndex + 1);
          }
          fn = events[key];

          (function (fn) {
            // Use 'on' instead of the elem[type] so that the handlers
            // stay bound if the view is updated with new elements
            view.$el.on(type, selector, function (event) {
              if (_this[fn] === undefined) {
                throw new Error('mixin target has no function: ' + fn);
              }
              _this[fn](event, view);
            });
          })(fn);
        })();
      }
    }
  }

  attachEvents();
}
1066883
function(elem, value){

    if(typeof value=== 'string'){
      value = _.fixObjStr(value)
    }
    var isNotHtml = elem.namespaceURI && elem.namespaceURI !== namespaces.html ;
    this.$watch(value, function(nvalue){
      var className = isNotHtml? elem.getAttribute('class'): elem.className;
      className = ' '+ (className||'').replace(/\s+/g, ' ') +' ';
      for(var i in nvalue) if(nvalue.hasOwnProperty(i)){
        className = className.replace(' ' + i + ' ',' ');
        if(nvalue[i] === true){
          className += i+' ';
        }
      }
      className = className.trim();
      if(isNotHtml){
        dom.attr(elem, 'class', className)
      }else{
        elem.className = className
      }
    }, DEEP_STABLE);
  }
94330
function upTo(el, tagName) {
  tagName = tagName.toLowerCase();

  while (el && el.parentNode) {
    el = el.parentNode;
    if (el.tagName && el.tagName.toLowerCase() == tagName) {
      return el;
    }
  }
  // Many DOM methods return null if they don't
  // find the element they are searching for
  // It would be OK to omit the following and just
  // return undefined
  return null;
}
1165029
function(elem, currentText) {

            var self = this;

            if(self.options["html"]) {

                elem.html(currentText);

            }

            else {

                elem.text(currentText);

            }

            return self;

        }
804227
function( a, b ) {
            this.id = b.attr('id');
            this.instances = [];
            this.element = b;
            this.options = jQuery.extend(this.options, a);
            this._create();
            if ( this._init ) {
                this._init();
            }
        }
539510
function(item)
	{
		var boundView, element, i;

		if(!this.viewTemplate)
		{
			element = this.view.element.cloneNode(true);

			this.boundViewOptions.element = element;

			boundView = new this.view.constructor(this.boundViewOptions);

			boundView._collectionBinder = null;
			boundView._modelBindersMap = this.view._modelBindersMap.clone();

			this.boundViews.push(boundView);
			i = this.boundViews.length - 1;

			boundView.scope['*'] = this.cursor.refine([i]);
			if(this.view._itemAlias) boundView.scope[this.view._itemAlias] = boundView.scope['*'];

			boundView.setBindingIndex(i);

			boundView.renderAll();

			this.viewTemplate = boundView._clone();
			this.elementTemplate = element.cloneNode(true);
		}
		else
		{
			element = this.elementTemplate.cloneNode(true);
			boundView = this.viewTemplate._clone();
			boundView._setParentView(this.view);

			this.boundViews.push(boundView);
			i = this.boundViews.length - 1;

			boundView.scope['*'] = this.cursor.refine([i]);
			if(this.view._itemAlias) boundView.scope[this.view._itemAlias] = boundView.scope['*'];

			boundView.setBindingIndex(i);
			boundView._rebindElement(element);
		}

		element.setAttribute(settings.DATA_RENDERED_ATTR, true);

		boundView._itemAlias = this.view._itemAlias;
		boundView._modelBindersMap.setView(boundView);

		return boundView;
	}
1250299
function(el, cls) {
      var elClass = el.className;
      var blank = (elClass !== '') ? ' ' : '';
      var added = elClass + blank + cls;
      el.className = added;
    }
1236781
function() {
	
	   // Create a DIV element to wrap the editing el and the image
	   this.divEl = inputEx.cn('div', {className: 'inputEx-fieldWrapper'});
	   if(this.options.id) {
	      this.divEl.id = this.options.id;
	   }
	   if(this.options.required) {
	      Dom.addClass(this.divEl, "inputEx-required");
	   }
	   
	   // Label element
	   if(this.options.label) {
	      this.labelDiv = inputEx.cn('div', {id: this.divEl.id+'-label', className: 'inputEx-label', 'for': this.divEl.id+'-field'});
	      this.labelEl = inputEx.cn('label');
	      this.labelEl.appendChild( document.createTextNode(this.options.label) );
	      this.labelDiv.appendChild(this.labelEl);
	      this.divEl.appendChild(this.labelDiv);
      }
      
      this.fieldContainer = inputEx.cn('div', {className: this.options.className}); // for wrapping the field and description
	
      // Render the component directly
      this.renderComponent();
      
      // Description
      if(this.options.description) {
         this.fieldContainer.appendChild(inputEx.cn('div', {id: this.divEl.id+'-desc', className: 'inputEx-description'}, null, this.options.description));
      }
      
   	this.divEl.appendChild(this.fieldContainer);
      
	   // Insert a float breaker
	   this.divEl.appendChild( inputEx.cn('div',null, {clear: 'both'}," ") );
	
	}
282844
function(el, template, context, opts) {
      opts = opts || {};
      if (_.isString(template)) {
        opts.newHTML = template;
      }
      templateRenderer.render(el, template, context, opts);
    }
1037421
def element_from_dom_node(obj, identifier_string = nil)
      element_class = Util.htmlunit2celerity(obj.class) || Element
      element = element_class.new(self, :object, obj)

      element.identifier_string = identifier_string
      element.extend(ClickableElement) unless element.is_a?(ClickableElement)

      element
    end
470083
function (el) {

            var document = Aria.$window.document;
            // Need to make sure the new element has the same exact styling applied as the original element so we use
            // the same tag, class, style and append it to the same parent
            var tempSizerEl = document.createElement(el.tagName);
            tempSizerEl.className = el.className;
            tempSizerEl.setAttribute("style", el.getAttribute("style"));
            el.parentNode.appendChild(tempSizerEl);

            // Now we need to make sure the element displays on one line and is not visible in the page
            tempSizerEl.style.visibility = "hidden";
            tempSizerEl.style.position = "absolute";
            tempSizerEl.style.whiteSpace = "nowrap";

            return tempSizerEl;
        }
215076
function createEl(tag, prop) {
let el = document.createElement(tag || 'div'),
    n;

for (n in prop) el[n] = prop[n];
return el;
}
1299936
function(options) {
  options = options || {};
  var that = this;
  // Either use the provided element or make up a new element
  this.el = options.el || window.document.createElement(options.elementType || 'div');
  this.$el = $(this.el);

  this.dispatchDOMEvents();
}