'use strict';

var PARSE_TYPE = 'text/html';
var UID_KEY = 'uid';
var DO_CLONE_ATTRIBUTES = true;
var DOM_PARSER = new DOMParser();

function create(str) {
    return document.createElement(str);
}

function parse(str) {
    return DOM_PARSER.parseFromString(str, PARSE_TYPE).body;
}

function clone(domNode) {
    return domNode.cloneNode(DO_CLONE_ATTRIBUTES);
}

function query(domNode, selector) {
    return domNode.querySelectorAll(selector);
}

function empty(domNode) {
    while (domNode.firstChild) {
        domNode.removeChild(domNode.firstChild);
    }
}

function transferChildNodes(from, to) {
    while (from.childNodes[0]) {
        to.appendChild(from.childNodes[0]);
    }
}

function getUID(domNode) {
    return domNode.getAttribute(UID_KEY);
}

function attachAttributeToNodes(domNode, key, value) {
    domNode.setAttribute(key, value);
    for (var i = 0; i < domNode.children.length; i++) {
        attachAttributeToNodes(domNode.children[i], key, value);
    }
}

module.exports = {
    create: create,
    parse: parse,
    clone: clone,
    query: query,
    empty: empty,
    transferChildNodes: transferChildNodes,
    getUID: getUID,
    attachAttributeToNodes: attachAttributeToNodes
};

@@ -126,16 +126,72 @@
 ser();%0A%0A
+var LEAF_NODES = %7B%0A    'famous:html-element' : true%0A%7D;%0A%0A
 function
@@ -904,24 +904,108 @@
 ey, value);%0A
+%0A    var name = domNode.tagName.toLowerCase();%0A    if (!(name in LEAF_NODES)) %7B%0A    
     for (var
@@ -1052,24 +1052,28 @@
 ) %7B%0A        
+  
+  
 attachAttrib
@@ -1117,16 +1117,26 @@
 value);%0A
+        %7D%0A
     %7D%0A%7D%0A

Check for LEAF_NODE when attaching attributes in V.Dom