Skip to content
This repository has been archived by the owner on Dec 22, 2023. It is now read-only.

Fixing parser's error message when multiple roots are found #1

Merged
merged 1 commit into from
Jun 25, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ var Html2React = function(React) {
var domTree = parseHtmlToTree(html);
// TODO: Deal with HTML that contains more than one root level node
if (domTree && domTree.length !== 1) {
throw new Error('html-to-react currently only supports HTML with one single root element.' +
'The HTML provided contains ' + domTree.length + ' root elements. You can fix that by simply wrapping your HTML' +
'in a <div> element');
throw new Error('html-to-react currently only supports HTML with one single root element. ' +
'The HTML provided contains ' + domTree.length + ' root elements. You can fix that by simply wrapping your HTML ' +
'in a <div> element.');
}
return traverseDom(domTree[0], isValidNode, processingInstructions);
};
Expand Down