Skip to content

Commit

Permalink
[expect] optimize compare nodes (#8368)
Browse files Browse the repository at this point in the history
* [expect] optimize compare nodes 🎨

* Remove needless varible

* Update CHANGELOG.md
  • Loading branch information
Connormiha authored and pedrottimark committed Apr 27, 2019
1 parent 8b6464d commit 4c3c712
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -30,6 +30,7 @@
- `[docs]` Mention Jest MongoDB Preset ([#8318](https://github.com/facebook/jest/pull/8318))
- `[@jest/reporters]` Migrate away from `istanbul-api` ([#8294](https://github.com/facebook/jest/pull/8294))
- `[*]` Delete obsolete emails tag from header comment in test files ([#8377](https://github.com/facebook/jest/pull/8377))
- `[expect]` optimize compare nodes ([#8368](https://github.com/facebook/jest/pull/8368))

### Performance

Expand Down
4 changes: 1 addition & 3 deletions packages/expect/src/jasmineUtils.ts
Expand Up @@ -126,10 +126,8 @@ function eq(
return false;
}

var aIsDomNode = isDomNode(a);
var bIsDomNode = isDomNode(b);
// Use DOM3 method isEqualNode (IE>=9)
if (aIsDomNode && typeof a.isEqualNode === 'function' && bIsDomNode) {
if (isDomNode(a) && isDomNode(b)) {
return a.isEqualNode(b);
}

Expand Down

0 comments on commit 4c3c712

Please sign in to comment.