Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/clone-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function cloneElement(vnode, props, children) {
for (i in props) {
if (i == 'key') key = props[i];
else if (i == 'ref') ref = props[i];
else if (props[i] === UNDEFINED && defaultProps !== UNDEFINED) {
else if (props[i] == UNDEFINED && defaultProps != UNDEFINED) {
normalizedProps[i] = defaultProps[i];
} else {
normalizedProps[i] = props[i];
Expand Down
4 changes: 2 additions & 2 deletions src/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function BaseComponent(props, context) {
BaseComponent.prototype.setState = function (update, callback) {
// only clone state when copying to nextState the first time.
let s;
if (this._nextState != NULL && this._nextState !== this.state) {
if (this._nextState != NULL && this._nextState != this.state) {
s = this._nextState;
} else {
s = this._nextState = assign({}, this.state);
Expand Down Expand Up @@ -204,7 +204,7 @@ export function enqueueRender(c) {
(c._dirty = true) &&
rerenderQueue.push(c) &&
!process._rerenderCount++) ||
prevDebounce !== options.debounceRendering
prevDebounce != options.debounceRendering
) {
prevDebounce = options.debounceRendering;
(prevDebounce || defer)(process);
Expand Down
2 changes: 1 addition & 1 deletion src/create-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function createContext(defaultValue) {

this.shouldComponentUpdate = function (_props) {
// @ts-expect-error even
if (this.props.value !== _props.value) {
if (this.props.value != _props.value) {
subs.forEach(c => {
c._force = true;
enqueueRender(c);
Expand Down
2 changes: 1 addition & 1 deletion src/create-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function createElement(type, props, children) {
// Note: type may be undefined in development, must never error here.
if (typeof type == 'function' && type.defaultProps != NULL) {
for (i in type.defaultProps) {
if (normalizedProps[i] === UNDEFINED) {
if (normalizedProps[i] == UNDEFINED) {
normalizedProps[i] = type.defaultProps[i];
}
}
Expand Down
16 changes: 8 additions & 8 deletions src/diff/children.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export function diffChildren(

// At this point, constructNewChildrenArray has assigned _index to be the
// matchingIndex for this VNode's oldVNode (or -1 if there is no oldVNode).
if (childVNode._index === -1) {
if (childVNode._index == -1) {
oldVNode = EMPTY_OBJ;
} else {
oldVNode = oldChildren[childVNode._index] || EMPTY_OBJ;
Expand Down Expand Up @@ -207,7 +207,7 @@ function constructNewChildrenArray(
NULL,
NULL
);
} else if (childVNode.constructor === UNDEFINED && childVNode._depth > 0) {
} else if (childVNode.constructor == UNDEFINED && childVNode._depth > 0) {
// VNode is already in use, clone it. This can happen in the following
// scenario:
// const reuse = <div />
Expand Down Expand Up @@ -238,7 +238,7 @@ function constructNewChildrenArray(
));

oldVNode = NULL;
if (matchingIndex !== -1) {
if (matchingIndex != -1) {
oldVNode = oldChildren[matchingIndex];
remainingOldChildren--;
if (oldVNode) {
Expand All @@ -248,8 +248,8 @@ function constructNewChildrenArray(

// Here, we define isMounting for the purposes of the skew diffing
// algorithm. Nodes that are unsuspending are considered mounting and we detect
// this by checking if oldVNode._original === null
const isMounting = oldVNode == NULL || oldVNode._original === NULL;
// this by checking if oldVNode._original == null
const isMounting = oldVNode == NULL || oldVNode._original == NULL;

if (isMounting) {
if (matchingIndex == -1) {
Expand Down Expand Up @@ -428,7 +428,7 @@ function findMatchingIndex(
(oldVNode === NULL && childVNode.key == null) ||
(oldVNode &&
key == oldVNode.key &&
type === oldVNode.type &&
type == oldVNode.type &&
(oldVNode._flags & MATCHED) == 0)
) {
return skewedIndex;
Expand All @@ -442,7 +442,7 @@ function findMatchingIndex(
oldVNode &&
(oldVNode._flags & MATCHED) == 0 &&
key == oldVNode.key &&
type === oldVNode.type
type == oldVNode.type
) {
return x;
}
Expand All @@ -455,7 +455,7 @@ function findMatchingIndex(
oldVNode &&
(oldVNode._flags & MATCHED) == 0 &&
key == oldVNode.key &&
type === oldVNode.type
type == oldVNode.type
) {
return y;
}
Expand Down
22 changes: 11 additions & 11 deletions src/diff/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export function diff(

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

// If the previous diff bailed out, resume creating/hydrating.
if (oldVNode._flags & MODE_SUSPENDED) {
Expand Down Expand Up @@ -369,7 +369,7 @@ export function commitRoot(commitQueue, root, refQueue) {
}

function cloneNode(node) {
if (typeof node !== 'object' || node == NULL) {
if (typeof node != 'object' || node == NULL) {
return node;
}

Expand Down Expand Up @@ -467,9 +467,9 @@ function diffElementNodes(
excessDomChildren = NULL;
}

if (nodeType === NULL) {
if (nodeType == NULL) {
// During hydration, we still have to split merged text from SSR'd HTML.
if (oldProps !== newProps && (!isHydrating || dom.data !== newProps)) {
if (oldProps !== newProps && (!isHydrating || dom.data != newProps)) {
dom.data = newProps;
}
} else {
Expand Down Expand Up @@ -531,8 +531,8 @@ function diffElementNodes(
if (
!isHydrating &&
(!oldHtml ||
(newHtml.__html !== oldHtml.__html &&
newHtml.__html !== dom.innerHTML))
(newHtml.__html != oldHtml.__html &&
newHtml.__html != dom.innerHTML))
) {
dom.innerHTML = newHtml.__html;
}
Expand All @@ -543,7 +543,7 @@ function diffElementNodes(

diffChildren(
// @ts-expect-error
newVNode.type === 'template' ? dom.content : dom,
newVNode.type == 'template' ? dom.content : dom,
isArray(newChildren) ? newChildren : [newChildren],
newVNode,
oldVNode,
Expand Down Expand Up @@ -572,7 +572,7 @@ function diffElementNodes(
if (nodeType == 'progress' && inputValue == NULL) {
dom.removeAttribute('value');
} else if (
inputValue !== UNDEFINED &&
inputValue != UNDEFINED &&
// #2756 For the <progress>-element the initial value is 0,
// despite the attribute not being present. When the attribute
// is missing the progress bar is treated as indeterminate.
Expand All @@ -582,13 +582,13 @@ function diffElementNodes(
// This is only for IE 11 to fix <select> value not being updated.
// To avoid a stale select value we need to set the option.value
// again, which triggers IE11 to re-evaluate the select value
(nodeType == 'option' && inputValue !== oldProps[i]))
(nodeType == 'option' && inputValue != oldProps[i]))
) {
setProperty(dom, i, inputValue, oldProps[i], namespace);
}

i = 'checked';
if (checked !== UNDEFINED && checked !== dom[i]) {
if (checked != UNDEFINED && checked != dom[i]) {
setProperty(dom, i, checked, oldProps[i], namespace);
}
}
Expand Down Expand Up @@ -636,7 +636,7 @@ export function unmount(vnode, parentVNode, skipRemove) {
if (options.unmount) options.unmount(vnode);

if ((r = vnode.ref)) {
if (!r.current || r.current === vnode._dom) {
if (!r.current || r.current == vnode._dom) {
applyRef(r, NULL, parentVNode);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/diff/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function setProperty(dom, name, value, oldValue, namespace) {

if (value) {
for (name in value) {
if (!oldValue || value[name] !== oldValue[name]) {
if (!oldValue || value[name] != oldValue[name]) {
setStyle(dom.style, name, value[name]);
}
}
Expand Down
Loading