html-to-vdom
Advanced tools
Comparing version 0.5.5 to 0.6.0
@@ -16,10 +16,14 @@ var createConverter = require('./htmlparser-to-vdom'); | ||
var convertedHTML; | ||
if (tags.length > 1) { | ||
throw new Error('Input must always have only one root node. You cannot convert multiple siblings without a wrapping tag around them.'); | ||
convertedHTML = tags.map(function (tag) { | ||
return htmlparserToVdom.convert(tag, getVNodeKey); | ||
}); | ||
} | ||
var convertedHTML = htmlparserToVdom.convert(tags[0], getVNodeKey); | ||
else { | ||
convertedHTML = htmlparserToVdom.convert(tags[0], getVNodeKey); | ||
} | ||
return convertedHTML; | ||
}; | ||
}; |
{ | ||
"name": "html-to-vdom", | ||
"version": "0.5.5", | ||
"version": "0.6.0", | ||
"description": "Converts html into a vtree", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -13,2 +13,4 @@ html-to-vdom [![Build Status](https://travis-ci.org/TimBeyer/html-to-vdom.svg?branch=master)](https://travis-ci.org/TimBeyer/html-to-vdom) | ||
As of v0.6.0, converting sibling nodes without an enclosing parent tag returns an array of type `VNode` instead of throwing an error | ||
As of v0.5.1, `html-to-vdom` no longer supports browsers without a full ES5 implementation. | ||
@@ -15,0 +17,0 @@ |
@@ -21,6 +21,9 @@ var VNode = require('virtual-dom/vnode/vnode'); | ||
describe('when converting multiple sibling nodes without a wrapper', function () { | ||
it('throws', function () { | ||
var html = ' <div></div>'; | ||
it('returns an array of vnodes', function () { | ||
var html = '<div id="foo"></div><div id="bar"></div>'; | ||
should.throw(convertHTML.bind(null, html), 'Input must always have only one root node. You cannot convert multiple siblings without a wrapping tag around them.'); | ||
var converted = convertHTML(html); | ||
converted.should.be.an('array'); | ||
converted[0].properties.id.should.equal('foo'); | ||
converted[1].properties.id.should.equal('foo'); | ||
}); | ||
@@ -27,0 +30,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
26519
426
78