Skip to content

Commit

Permalink
Merge pull request #40 from tomekwi/readme
Browse files Browse the repository at this point in the history
Document usage in node
  • Loading branch information
stephenmathieson committed Jun 12, 2015
2 parents 7422b9e + e6f2871 commit db7fa80
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions Readme.md
Expand Up @@ -4,13 +4,23 @@ Turn HTML into DOM elements x-browser.

## Usage

Works out of the box in the browser:

```js
var domify = require('domify')
var domify = require('domify');

document.addEventListener('DOMContentLoaded', function() {
var el = domify('<p>Hello <em>there</em></p>')
document.body.appendChild(el)
})
var el = domify('<p>Hello <em>there</em></p>');
document.body.appendChild(el);
});
```

You can also run it in *node* and *iojs*. Just pass a custom implementation of `document`:

```js
var jsdom = require('jsdom').jsdom();

domify('<p>Hello <em>there</em></p>', jsdom.defaultView.document);
```

## Running tests
Expand Down

0 comments on commit db7fa80

Please sign in to comment.