@yuheiy/childnode-ponyfill
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -24,13 +24,6 @@ "use strict"; | ||
} | ||
return nodes.reduce(function (frag, node) { | ||
if (typeof node === 'string') { | ||
var parser = document.createElement('div'); | ||
parser.innerHTML = node; | ||
while (parser.firstChild) { | ||
frag.appendChild(parser.firstChild); | ||
} | ||
} | ||
else { | ||
frag.appendChild(node); | ||
} | ||
return nodes.reduce(function (frag, nodeOrDomString) { | ||
var isNode = nodeOrDomString instanceof Node; | ||
var node = isNode ? nodeOrDomString : document.createTextNode(String(nodeOrDomString)); | ||
frag.appendChild(node); | ||
return frag; | ||
@@ -37,0 +30,0 @@ }, document.createDocumentFragment()); |
@@ -14,3 +14,3 @@ { | ||
}, | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"main": "lib/childnode-ponyfill.js", | ||
@@ -17,0 +17,0 @@ "types": "lib/childnode-ponyfill.d.ts", |
@@ -24,12 +24,6 @@ type ImplementsOfChildNode = Element | DocumentType | CharacterData | ||
const createDocumentFragmentFromNodes = (...nodes: /*Nodes*/Array<any>): DocumentFragment => { | ||
return nodes.reduce((frag, node) => { | ||
if (typeof node === 'string') { | ||
const parser = document.createElement('div') | ||
parser.innerHTML = node | ||
while (parser.firstChild) { | ||
frag.appendChild(parser.firstChild) | ||
} | ||
} else { | ||
frag.appendChild(node) | ||
} | ||
return nodes.reduce((frag, nodeOrDomString) => { | ||
const isNode = nodeOrDomString instanceof Node | ||
const node = isNode ? nodeOrDomString : document.createTextNode(String(nodeOrDomString)) | ||
frag.appendChild(node) | ||
return frag | ||
@@ -36,0 +30,0 @@ }, document.createDocumentFragment()) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10869
143