Skip to content

Commit 294d6e0

Browse files
streamichchrisbolin
authored andcommitted
Optimizations (#41)
* perf: ⚡️ remove redundant instanceof Element check On the next line tripple equals === should ensure b is instance of Element. * perf: ⚡️ remove redundant a === b expression The very first line of the function already checks `if (a === b) return true;`, so at this point we know for sure that a !== b
1 parent 651f5fd commit 294d6e0

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ function equal(a, b) {
4848

4949
// start react-fast-compare
5050
// custom handling for DOM elements
51-
if (hasElementType && a instanceof Element && b instanceof Element)
52-
return a === b;
51+
if (hasElementType && a instanceof Element)
52+
return false;
5353

5454
// custom handling for React
5555
for (i = length; i-- !== 0;) {

0 commit comments

Comments
 (0)