* 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)
| 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 |
no test coverage detected