Skip to content

Commit 37c3e03

Browse files
authored
Strict equality check on constructor (#4985)
1 parent 6670a4a commit 37c3e03

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/create-element.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,4 @@ export function Fragment(props) {
9494
* @returns {vnode is VNode}
9595
*/
9696
export const isValidElement = vnode =>
97-
vnode != NULL && vnode.constructor == UNDEFINED;
97+
vnode != NULL && vnode.constructor === UNDEFINED;

src/diff/children.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ function constructNewChildrenArray(
205205
NULL,
206206
NULL
207207
);
208-
} else if (childVNode.constructor == UNDEFINED && childVNode._depth > 0) {
208+
} else if (childVNode.constructor === UNDEFINED && childVNode._depth > 0) {
209209
// VNode is already in use, clone it. This can happen in the following
210210
// scenario:
211211
// const reuse = <div />

src/diff/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export function diff(
6464

6565
// When passing through createElement it assigns the object
6666
// constructor as undefined. This to prevent JSON-injection.
67-
if (newVNode.constructor != UNDEFINED) return NULL;
67+
if (newVNode.constructor !== UNDEFINED) return NULL;
6868

6969
// If the previous diff bailed out, resume creating/hydrating.
7070
if (oldVNode._flags & MODE_SUSPENDED) {

0 commit comments

Comments
 (0)