Skip to content

Commit

Permalink
Fix terminology in README
Browse files Browse the repository at this point in the history
  • Loading branch information
aknuds1 committed Feb 8, 2017
1 parent 77a9786 commit aa8690e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ React tree with one single parent.

### Simple

The following example parses each node and its attributes and returns a tree of React components.
The following example parses each node and its attributes and returns a tree of React elements.

```javascript
var React = require('react');
var ReactDOMServer = require('react-dom/server');
var HtmlToReactParser = require('html-to-react').Parser;

var htmlInput = '<div><h1>Title</h1><p>A paragraph</p></div>';
var htmlToReactParser = new HtmlToReactParser();
var reactComponent = htmlToReactParser.parse(htmlInput);
var reactHtml = React.renderToStaticMarkup(reactComponent);
var reactElement = htmlToReactParser.parse(htmlInput);
var reactHtml = ReactDOMServer.renderToStaticMarkup(reactElement);

assert.equal(reactHtml, htmlInput); // true
```
Expand All @@ -63,7 +63,7 @@ If certain DOM nodes require specific processing, for example if you want to cap
`<h1>` tag, the following example demonstrates this:

```javascript
var React = require('react');
var ReactDOMServer = require('react-dom/server');
var HtmlToReactParser = require('html-to-react').Parser;

var htmlInput = '<div><h1>Title</h1><p>Paragraph</p><h1>Another title</h1></div>';
Expand Down Expand Up @@ -94,7 +94,7 @@ var processingInstructions = [
var htmlToReactParser = new HtmlToReactParser();
var reactComponent = htmlToReactParser.parseWithInstructions(htmlInput, isValidNode,
processingInstructions);
var reactHtml = React.renderToStaticMarkup(reactComponent);
var reactHtml = ReactDOMServer.renderToStaticMarkup(reactComponent);
assert.equal(reactHtml, htmlExpected);
```

Expand Down
6 changes: 3 additions & 3 deletions lib/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ function Html2ReactParser(options) {
}, processingInstructions);
if (processingInstruction != null) {
var children = reject(function (x) {return x == null || x === false;},
addIndex(map)(function (child, i) {
return traverseDom(child, isValidNode, processingInstructions, i);
}, node.children || []));
addIndex(map)(function (child, i) {
return traverseDom(child, isValidNode, processingInstructions, i);
}, node.children || []));

if (processingInstruction.replaceChildren) {
return utils.createElement(node, index, node.data, [
Expand Down

0 comments on commit aa8690e

Please sign in to comment.