MCPcopy Create free account
hub / github.com/breck7/scroll / _createNode

Function _createNode

external/.datatables.js:16007–16027  ·  view source on GitHub ↗

* Create an XML node and add any children, attributes, etc without needing to * be verbose in the DOM. * * @param {object} doc XML document * @param {string} nodeName Node name * @param {object} opts Options - can be `attr` (attributes), `children` * (child nodes) and `text

(doc, nodeName, opts)

Source from the content-addressed store, hash-verified

16005 * @return {node} Created node
16006 */
16007 function _createNode(doc, nodeName, opts) {
16008 var tempNode = doc.createElement(nodeName)
16009
16010 if (opts) {
16011 if (opts.attr) {
16012 $(tempNode).attr(opts.attr)
16013 }
16014
16015 if (opts.children) {
16016 $.each(opts.children, function (key, value) {
16017 tempNode.appendChild(value)
16018 })
16019 }
16020
16021 if (opts.text !== null && opts.text !== undefined) {
16022 tempNode.appendChild(doc.createTextNode(opts.text))
16023 }
16024 }
16025
16026 return tempNode
16027 }
16028
16029 /**
16030 * Get the width for an Excel column based on the contents of that column

Callers 3

_excelMergeCellsFunction · 0.85
addRowFunction · 0.85
.datatables.jsFile · 0.85

Calls 2

eachMethod · 0.80
$Function · 0.70

Tested by

no test coverage detected