Wraps the given node in a new element with the given tag created using the given factory.
491215
function wrap (factory, node, tag) {
    // If there is a previous node that is not text, insert a new line to
    // for 
    if (node.previousSibling != null && node.previousSibling.nodeType != 3) {
        var newline = factory.createTextNode("\n");
        body.insertBefore(newline, node);
    }
    var wrapper = factory.createElement(tag);
    node.parentNode.insertBefore(wrapper, node);
    wrapper.appendChild(node);
    return wrapper;
  }
21152
def _construct_node(loader, node, base_tag):
    ""
    node = copy.copy(node) # bypass YAML anti recursion
    best_tag = base_tag
    best_fit = 0
    for key, val in loader.DEFAULT_TAGS.iteritems():
        lenk = len(key)
        if lenk <= best_fit:
            continue
        if base_tag.startswith(key):
            best_tag = val + base_tag[lenk:]
            best_fit = lenk
    node.tag = best_tag
    return loader.construct_object(node, deep=True)
21377
private Object newObj(Object obj, Element node) throws Exception {
		Class<?> oClass = nodeClass(node);
		String id = getAttribute(node, "id");
		int size = 0;
		Element[] children = getChildren(node);
		int argi = children.length;
		for (int i = 0; i < children.length; i++) {
			Element element = children[i];

			if (!(element.getTagName().equals("Arg"))) {
				argi = i;
				break;
			}
			size++;
		}

		//CHECKSTYLE:OFF
		Object[] arg = new Object[size];
		for (int i = 0, j = 0; j < size; i++) {
			Element o = children[i];
			arg[j++] = value(obj, o);
		}
		//CHECKSTYLE:ON

		if (LOG.isDebugEnabled()) {
			LOG.debug("XML new " + oClass);
		}

		// Lets just try all constructors for now
		Constructor<?>[] constructors = oClass.getConstructors();
		for (int c = 0; constructors != null && c < constructors.length; c++) {
			if (constructors[c].getParameterTypes().length != size) {
				continue;
			}

			Object n = null;
			boolean called = false;
			try {
				n = constructors[c].newInstance(arg);
				called = true;
			} catch (IllegalAccessException e) {
				if (LOG.isInfoEnabled()) {
					LOG.info(
							"IllegalAccessException while parsing jetty-web.xml",
							e);
				}
			} catch (InstantiationException e) {
				if (LOG.isInfoEnabled()) {
					LOG.info(
							"InstantiationException while parsing jetty-web.xml",
							e);
				}
			} catch (IllegalArgumentException e) {
				if (LOG.isInfoEnabled()) {
					LOG.info(
							"IllegalArgumentException while parsing jetty-web.xml",
							e);
				}
			}
			if (called) {
				if (id != null) {
					_idMap.put(id, n);
				}
				configure(n, node, argi);
				return n;
			}
		}

		throw new IllegalStateException("No Constructor: " + node + " on "
				+ obj);
	}
924605
public TagSetModel getOrCreate(GraphRewrite event, Set<String> tags)
    {
        Map<Set<String>, Vertex> cache = getCache(event);
        Vertex vertex = cache.get(tags);
        if (vertex == null)
        {
            TagSetModel model = create();
            model.setTags(tags);
            cache.put(tags, model.getElement());
            return model;
        }
        else
        {
            return frame(vertex);
        }
    }
1217279
public Element createElement(String tagName, String id) {
		Element element = DOM.createElement(tagName).cast();
		DOM.setElementAttribute(element, "id", id);
		return element;
	}
937994
function createElement(tag, attribs, styles, parent, nopad) {
	var el = doc.createElement(tag);
	if (attribs) {
		extend(el, attribs);
	}
	if (nopad) {
		css(el, {padding: 0, border: NONE, margin: 0});
	}
	if (styles) {
		css(el, styles);
	}
	if (parent) {
		parent.appendChild(el);
	}
	return el;
}
94823
def wrap(node, tag):
    """"""
    wrap_node = node.ownerDocument.createElement(tag)
    parent = node.parentNode
    if parent:
        parent.replaceChild(wrap_node, node)
    wrap_node.appendChild(node)
    return wrap_node
226918
function CreateHTMLNode(tag) {
    //jump table.
    switch (tag[0]) {
        case "w":
            switch (tag) {
                case "w-s":
                    return new SourceNode$1(); //This node is used to 
                case "w-c":
                    return new SourceTemplateNode$1(); //This node is used to 
            }
            break;
        default:
            switch (tag) {
                case "a":
                    return new LinkNode$1();
                /** void elements **/
                case "template":
                    return new VoidNode$1();
                case "style":
                    return new StyleNode$1();
                case "script":
                    return new ScriptNode$1();
                case "svg":
                case "path":
                    return new SVGNode();
            }
    }

    return new RootNode();
}
750465
function createFactory(type) {
    const ret = createElement.bind(null, type);
    ret.type = type;

    return ret;
}
1156209
function createElement(node, document) {
	var tag = void 0;
	if ((typeof node === 'undefined' ? 'undefined' : _typeof(node)) !== 'object') {
		// we have a text node, so create one
		tag = document.createTextNode('' + node);
	} else {
		tag = document.createElement(node.tagName);
		// add all required attributes
		Object.keys(node.attributes).forEach(function (attr) {
			tag.setAttribute(attr, node.attributes[attr].value);
		});
		// define it's inner structure
		tag.innerHTML = getInnerHTML(node);
		tag.__hash = node.__hash;
		attachSetAttribute(tag);
	}

	return tag;
}
773302
public Tag decorate(Tag tag)
    {
        if (XHTML_NAMESPACE.equals(tag.getNamespace()))
        {
            String n = tag.getLocalName();
            if ("a".equals(n))
            {
                return new Tag(tag.getLocation(), HtmlLibrary.NAMESPACE, "commandLink", tag.getQName(), tag
                        .getAttributes());
            }
            if ("form".equals(n))
            {
                return new Tag(tag.getLocation(), HtmlLibrary.NAMESPACE, "form", tag.getQName(), tag.getAttributes());
            }
            if ("input".equals(n))
            {
                TagAttribute attr = tag.getAttributes().get("type");
                if (attr != null)
                {
                    String t = attr.getValue();
                    TagAttributes na = removeType(tag.getAttributes());
                    if ("text".equals(t))
                    {
                        return new Tag(tag.getLocation(), HtmlLibrary.NAMESPACE, "inputText", tag.getQName(), na);
                    }
                    if ("password".equals(t))
                    {
                        return new Tag(tag.getLocation(), HtmlLibrary.NAMESPACE, "inputSecret", tag.getQName(), na);
                    }
                    if ("hidden".equals(t))
                    {
                        return new Tag(tag.getLocation(), HtmlLibrary.NAMESPACE, "inputHidden", tag.getQName(), na);
                    }
                    if ("submit".equals(t))
                    {
                        return new Tag(tag.getLocation(), HtmlLibrary.NAMESPACE, "commandButton", tag.getQName(), na);
                    }
                }
            }
        }
        return null;
    }
867943
function Element (tagName, props, children) {
  if (!(this instanceof Element)) {
    if (!_.isArray(children) && children != null) {
      children = _.slice(arguments, 2).filter(_.truthy)
    }
    return new Element(tagName, props, children)
  }

  if (_.isArray(props)) {
    children = props
    props = {}
  }

  this.tagName = tagName
  this.props = props || {}
  this.children = children || []
  this.key = props
    ? props.key
    : void 666

  var count = 0

  _.each(this.children, function (child, i) {
    if (child instanceof Element) {
      count += child.count
    } else {
      children[i] = '' + child
    }
    count++
  })

  this.count = count
}
1320508
function wrap(xhtml, tag) {
  var e = document.createElement('div');
  e.innerHTML = xhtml;
  return e;
}
255001
function (node, wrapperName) {
            var parent = node.parentNode;
            var wrapper = $('<' + wrapperName + '>')[0];

            parent.insertBefore(wrapper, node);
            wrapper.appendChild(node);

            return wrapper;
        }
368746
public static Element appendElement(Element parent, String tagName) {
        Element child = parent.getOwnerDocument().createElement(tagName);
        parent.appendChild(child);
        return child;
    }
1075324
function (elem)
    {
        var i, el;
        if (elem.nodeType == Strophe.ElementType.NORMAL) {
            el = Strophe.xmlElement(elem.tagName);

            for (i = 0; i < elem.attributes.length; i++) {
                el.setAttribute(elem.attributes[i].nodeName,
                                elem.attributes[i].value);
            }

            for (i = 0; i < elem.childNodes.length; i++) {
                el.appendChild(Strophe.copyElement(elem.childNodes[i]));
            }
        } else if (elem.nodeType == Strophe.ElementType.TEXT) {
            el = Strophe.xmlGenerator().createTextNode(elem.nodeValue);
        }

        return el;
    }
185862
function Tag(el, opts) {
      // get the tag properties from the class constructor
      var ref = this;
      var name = ref.name;
      var tmpl = ref.tmpl;
      var css = ref.css;
      var attrs = ref.attrs;
      var onCreate = ref.onCreate;
      // register a new tag and cache the class prototype
      if (!__TAG_IMPL[name]) {
        tag(name, tmpl, css, attrs, onCreate);
        // cache the class constructor
        __TAG_IMPL[name].class = this.constructor;
      }

      // mount the tag using the class instance
      mount$1(el, name, opts, this);
      // inject the component css
      if (css) { styleManager.inject(); }

      return this
    }