shabashj
4/21/2015 - 1:34 PM

Module example

Module example

var w5g;
(function (w5g) {
    (function (qunit) {

            // ------------------------------- XML Helper Functions -------------------------------
            function traverseNodeTree(oNode, fn, aNodes) {
                var sNode = fn(oNode);
                if (sNode != undefined) {
                    aNodes.push(sNode);
                }
                oNode = oNode.firstChild;
                while (oNode) {
                    traverseNodeTree(oNode, fn, aNodes);
                    oNode = oNode.nextSibling;
                }
                return aNodes;
            }

            function processNode(oNode) {
                var sNodeIdentifier = "";
                // only output 'controls' and comments
                if (oNode.nodeType === 1 || oNode.nodeType === 8) {
                    sNodeIdentifier = oNode.nodeName;
                    try {
                        // not all nodes have getAttribute, or the id could be empty
                        sNodeIdentifier = oNode.getAttribute("id") || sNodeIdentifier;
                    } catch (error) { /* no error handling */ }
                    return sNodeIdentifier;
                }
            }

            function getXMLofRootContorl(oDesignTime) {
                var oView;
                var	oViewXML;
                oView = oDesignTime.getRootControl();
                if (oView != undefined) {
                    oViewXML = oView.__XMLNode;
                }
                return oViewXML;
            }

            qunit.utils = {
                traverseNodeTree : traverseNodeTree,
                processNode : processNode,
                getXMLofRootControl : getXMLofRootContorl
            };

    })(w5g.qunit || (w5g.qunit = {}));
})(w5g || (w5g = {}));