snabbdom-virtualize
Advanced tools
Comparing version 0.2.1 to 0.3.0
12
index.js
@@ -93,7 +93,9 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
// otherwise. | ||
if (el.childNodes.length > 1) { | ||
throw new Error('Cannot virtualize multiple top-level nodes.'); | ||
} else if (el.childNodes.length === 1) { | ||
// Pull out the top-level node and run it through the virtualize fn. | ||
return snabbdomVirtualize(el.childNodes.item(0)); | ||
var _childNodes = Array.prototype.slice.call(el.childNodes); | ||
if (_childNodes.length === 1) { | ||
return snabbdomVirtualize(_childNodes[0]); | ||
} else { | ||
return _childNodes.map(function (child) { | ||
return snabbdomVirtualize(child); | ||
}); | ||
} | ||
@@ -100,0 +102,0 @@ } |
{ | ||
"name": "snabbdom-virtualize", | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"description": "Library for turning strings and DOM nodes into virtual DOM nodes compatible with snabbdom.", | ||
@@ -43,3 +43,6 @@ "author": { | ||
"snabbdom": "^0.3.0" | ||
}, | ||
"dependencies": { | ||
"html-parse-stringify": "^1.0.2" | ||
} | ||
} |
@@ -129,6 +129,10 @@ import virtualize from '../../src/index'; | ||
it("should throw an error when there's more than one top-level node passed in the string", () => { | ||
expect(() => { | ||
virtualize('<div><h1>Something</h1></div><span>Something more</span>') | ||
}).to.throw('Cannot virtualize multiple top-level nodes.'); | ||
it("should handle multiple top-level nodes, returning them as an array", () => { | ||
const actual = virtualize('<div><h1>Something</h1></div><span>Something more</span>'); | ||
expect(actual).to.deep.equal([ | ||
h('div', [ | ||
h('h1', ['Something']) | ||
]), | ||
h('span', ['Something more']) | ||
]); | ||
}); | ||
@@ -135,0 +139,0 @@ |
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
19165
436
2
+ Addedhtml-parse-stringify@^1.0.2
+ Addedajv@6.12.6(transitive)
+ Addedasn1@0.2.6(transitive)
+ Addedassert-plus@1.0.0(transitive)
+ Addedasynckit@0.4.0(transitive)
+ Addedaws-sign2@0.7.0(transitive)
+ Addedaws4@1.13.2(transitive)
+ Addedbcrypt-pbkdf@1.0.2(transitive)
+ Addedbuffer-crc32@0.2.13(transitive)
+ Addedbuffer-from@1.1.2(transitive)
+ Addedcaseless@0.12.0(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addedconcat-stream@1.6.2(transitive)
+ Addedcore-util-is@1.0.21.0.3(transitive)
+ Addeddashdash@1.14.1(transitive)
+ Addeddebug@2.6.9(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedecc-jsbn@0.1.2(transitive)
+ Addedes6-promise@4.2.8(transitive)
+ Addedextend@3.0.2(transitive)
+ Addedextract-zip@1.7.0(transitive)
+ Addedextsprintf@1.3.0(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
+ Addedfast-json-stable-stringify@2.1.0(transitive)
+ Addedfd-slicer@1.1.0(transitive)
+ Addedforever-agent@0.6.1(transitive)
+ Addedform-data@2.3.3(transitive)
+ Addedfs-extra@1.0.0(transitive)
+ Addedgetpass@0.1.7(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedhar-schema@2.0.0(transitive)
+ Addedhar-validator@5.1.5(transitive)
+ Addedhasha@2.2.0(transitive)
+ Addedhtml-parse-stringify@1.0.3(transitive)
+ Addedhttp-signature@1.2.0(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedis-stream@1.1.0(transitive)
+ Addedis-typedarray@1.0.0(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedisexe@2.0.0(transitive)
+ Addedisstream@0.1.2(transitive)
+ Addedjsbn@0.1.1(transitive)
+ Addedjson-schema@0.4.0(transitive)
+ Addedjson-schema-traverse@0.4.1(transitive)
+ Addedjson-stringify-safe@5.0.1(transitive)
+ Addedjsonfile@2.4.0(transitive)
+ Addedjsprim@1.4.2(transitive)
+ Addedkew@0.7.0(transitive)
+ Addedklaw@1.3.1(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedmkdirp@0.5.6(transitive)
+ Addedms@2.0.0(transitive)
+ Addedoauth-sign@0.9.0(transitive)
+ Addedpend@1.2.0(transitive)
+ Addedperformance-now@2.1.0(transitive)
+ Addedphantomjs-prebuilt@2.1.16(transitive)
+ Addedpinkie@2.0.4(transitive)
+ Addedpinkie-promise@2.0.1(transitive)
+ Addedprocess-nextick-args@2.0.1(transitive)
+ Addedprogress@1.1.8(transitive)
+ Addedpsl@1.9.0(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedqs@6.5.3(transitive)
+ Addedreadable-stream@2.3.8(transitive)
+ Addedrequest@2.88.2(transitive)
+ Addedrequest-progress@2.0.1(transitive)
+ Addedsafe-buffer@5.1.2(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsshpk@1.18.0(transitive)
+ Addedstring_decoder@1.1.1(transitive)
+ Addedthrottleit@1.0.1(transitive)
+ Addedtough-cookie@2.5.0(transitive)
+ Addedtunnel-agent@0.6.0(transitive)
+ Addedtweetnacl@0.14.5(transitive)
+ Addedtypedarray@0.0.6(transitive)
+ Addeduri-js@4.4.1(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addeduuid@3.4.0(transitive)
+ Addedverror@1.10.0(transitive)
+ Addedvoid-elements@1.0.0(transitive)
+ Addedwhich@1.3.1(transitive)
+ Addedyauzl@2.10.0(transitive)