Skip to content

Commit

Permalink
Add an example of shimming unimplemented APIs
Browse files Browse the repository at this point in the history
Closes #1729.
  • Loading branch information
domenic committed Feb 11, 2017
1 parent 55b6364 commit 0cdb2ef
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,25 @@ window.document.body.appendChild(scriptEl);
// though it originated in Node.js!
```

### Shimming unimplemented APIs

```js
var jsdom = require("jsdom");
var document = jsdom("", {
created(err, window) {
window.alert = () => {
// Do something different than jsdom's default "not implemented" virtual console error
};

Object.defineProperty(window, "outerWidth", {
get() { return 400; },
enumerable: true,
configurable: true
});
}
});
```

### Serializing a document

```js
Expand Down

0 comments on commit 0cdb2ef

Please sign in to comment.