src/index.js
function renderNode(rootNode) {
    let createdPromises = [];

    var document = getDocument(rootNode);

    recurseTree(rootNode, (foundNode) => {
        if (foundNode.tagName) {
            let nodeType = foundNode.tagName.toLowerCase();
            let customElement = registeredElements[nodeType];
            if (customElement) {
                // TODO: Should probably clone node, not change prototype, for performance
                Object.setPrototypeOf(foundNode, customElement);
                if (customElement.createdCallback) {
                    createdPromises.push(new Promise((resolve) => {
                        resolve(customElement.createdCallback.call(foundNode, document));
                    }));
                }
            }
        }
    });

    return Promise.all(createdPromises).then(() => rootNode);
}
function renderNode(rootNode) {
    let createdPromises = [];

    var document = getDocument(rootNode);

    recurseTree(rootNode, (foundNode) => {
        if (foundNode.tagName) {
            let nodeType = foundNode.tagName.toLowerCase();
            let customElement = registeredElements[nodeType];
            if (customElement) {
                // TODO: Should probably clone node, not change prototype, for performance
                Object.setPrototypeOf(foundNode, customElement);
                if (customElement.createdCallback) {
                    createdPromises.push(new Promise((resolve) => {
                        resolve(customElement.createdCallback.call(foundNode, document));
                    }));
                }
            }
        }
    });

    return Promise.all(createdPromises).then(() => rootNode);
}
function renderNode ( rootNode ) { let createdPromises = [ ] ; var document = getDocument ( rootNode ) ; recurseTree ( rootNode , ( foundNode ) => { if ( foundNode . tagName ) { let nodeType = foundNode . tagName . toLowerCase ( ) ; let customElement = registeredElements [ nodeType ] ; if ( customElement ) { // TODO: Should probably clone node, not change prototype, for performance Object . setPrototypeOf ( foundNode , customElement ) ; if ( customElement . createdCallback ) { createdPromises . push ( new Promise ( ( resolve ) => { resolve ( customElement . createdCallback . call ( foundNode , document ) ) ; } ) ) ; } } } } ) ; return Promise . all ( createdPromises ) . then ( ( ) => rootNode ) ; }
Takes a full Domino node object. Traverses within it and renders all the custom elements found.
Returns a promise for the document object itself, resolved when every custom element has
resolved, and rejected if any of them are rejected.
Takes a full Domino node object . Traverses within it and renders all the custom elements found . Returns a promise for the document object itself resolved when every custom element has resolved and rejected if any of them are rejected .