var _ = require("./utils"),
    $Element = require("./element"),
    DOM = require("./dom"),
    rquick = /^\w+$/,
    sandbox = document.createElement("div");

/**
 * Create a $Element instance
 * @memberOf DOM
 * @param  {Mixed}  value   HTMLString, EmmetString or native element
 * @param  {Object} [vars]  key/value map of variables in emmet template
 * @return {$Element} element
 */
DOM.create = function(value, vars) {
    if (typeof value === "string") {
        if (rquick.test(value)) {
            value = document.createElement(value);
        } else {
            sandbox.innerHTML = _.trim(DOM.template(value, vars));

            if (sandbox.childNodes.length !== 1 || sandbox.firstChild.nodeType !== 1) {
                return $Element(sandbox).children().remove();
            }

            value = sandbox.removeChild(sandbox.firstChild);
        }

        return new $Element(value);
    }

    if (value.nodeType === 1) return $Element(value);

    throw _.makeError("create", this);
};

@@ -91,21 +91,26 @@
 ),%0A    r
-quick
+eSingleTag
  = /%5E%5Cw+
@@ -478,13 +478,18 @@
 f (r
-quick
+eSingleTag
 .tes
@@ -669,13 +669,11 @@
 hild
-Nodes
+ren
 .len
@@ -685,30 +685,156 @@
 == 1
- %7C%7C sandbox.firstChild
+) %7B%0A                value = %5B%5D;%0A%0A                for (var node; node = sandbox.firstChild; sandbox.removeChild(node)) %7B%0A                    if (node
 .nod
@@ -839,24 +839,59 @@
 odeType 
-!
+=
 == 1) 
-%7B
+value.push(node);%0A                %7D%0A
 %0A       
@@ -898,32 +898,36 @@
          return 
+new 
 $Element(sandbox
@@ -923,35 +923,19 @@
 ent(
-sandbox).children().remove(
+value, true
 );%0A 

improve performance of DOM.create in some cases