Skip to content

Commit 5ddcfd2

Browse files
committed
Rename isCustomComponent to isCustomElement
That's the technical term.
1 parent 2af6c9c commit 5ddcfd2

File tree

4 files changed

+18
-25
lines changed

4 files changed

+18
-25
lines changed

packages/react-dom-bindings/src/client/ReactDOMComponent.js

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ import {
5858
} from './CSSPropertyOperations';
5959
import {HTML_NAMESPACE, getIntrinsicNamespace} from './DOMNamespaces';
6060
import {getPropertyInfo} from '../shared/DOMProperty';
61-
import isCustomComponent from '../shared/isCustomComponent';
61+
import isCustomElement from '../shared/isCustomElement';
6262
import possibleStandardNames from '../shared/possibleStandardNames';
6363
import {validateProperties as validateARIAProperties} from '../shared/ReactDOMInvalidARIAHook';
6464
import {validateProperties as validateInputProperties} from '../shared/ReactDOMNullInputValuePropHook';
@@ -264,7 +264,7 @@ function setProp(
264264
tag: string,
265265
key: string,
266266
value: mixed,
267-
isCustomComponentTag: boolean,
267+
isCustomElementTag: boolean,
268268
props: any,
269269
): void {
270270
switch (key) {
@@ -390,7 +390,7 @@ function setProp(
390390
warnForInvalidEventListener(key, value);
391391
}
392392
} else {
393-
if (isCustomComponentTag) {
393+
if (isCustomElementTag) {
394394
if (enableCustomElementPropertySupport) {
395395
setValueForPropertyOnCustomComponent(domElement, key, value);
396396
} else {
@@ -653,7 +653,7 @@ export function setInitialProperties(
653653
}
654654
// defaultChecked and defaultValue are ignored by setProp
655655
default: {
656-
// TODO: If the `is` prop is specified, this should go through the isCustomComponentTag flow.
656+
// TODO: If the `is` prop is specified, this should go through the isCustomElementTag flow.
657657
setProp(domElement, tag, propKey, propValue, false, props);
658658
}
659659
}
@@ -662,8 +662,8 @@ export function setInitialProperties(
662662
}
663663
}
664664

665-
const isCustomComponentTag =
666-
enableCustomElementPropertySupport && isCustomComponent(tag, props);
665+
const isCustomElementTag =
666+
enableCustomElementPropertySupport && isCustomElement(tag, props);
667667
for (const propKey in props) {
668668
if (!props.hasOwnProperty(propKey)) {
669669
continue;
@@ -672,7 +672,7 @@ export function setInitialProperties(
672672
if (propValue == null) {
673673
continue;
674674
}
675-
setProp(domElement, tag, propKey, propValue, isCustomComponentTag, props);
675+
setProp(domElement, tag, propKey, propValue, isCustomElementTag, props);
676676
}
677677
}
678678

@@ -949,7 +949,7 @@ export function updateProperties(
949949
}
950950
// defaultChecked and defaultValue are ignored by setProp
951951
default: {
952-
// TODO: If the `is` prop is specified, this should go through the isCustomComponentTag flow.
952+
// TODO: If the `is` prop is specified, this should go through the isCustomElementTag flow.
953953
setProp(domElement, tag, propKey, propValue, false, nextProps);
954954
}
955955
}
@@ -958,20 +958,13 @@ export function updateProperties(
958958
}
959959
}
960960

961-
const isCustomComponentTag =
962-
enableCustomElementPropertySupport && isCustomComponent(tag, nextProps);
961+
const isCustomElementTag =
962+
enableCustomElementPropertySupport && isCustomElement(tag, nextProps);
963963
// Apply the diff.
964964
for (let i = 0; i < updatePayload.length; i += 2) {
965965
const propKey = updatePayload[i];
966966
const propValue = updatePayload[i + 1];
967-
setProp(
968-
domElement,
969-
tag,
970-
propKey,
971-
propValue,
972-
isCustomComponentTag,
973-
nextProps,
974-
);
967+
setProp(domElement, tag, propKey, propValue, isCustomElementTag, nextProps);
975968
}
976969
}
977970

@@ -1357,7 +1350,7 @@ export function diffHydratedProperties(
13571350
extraAttributeNames.add(attributes[i].name);
13581351
}
13591352
}
1360-
if (isCustomComponent(tag, props)) {
1353+
if (isCustomElement(tag, props)) {
13611354
diffHydratedCustomComponent(
13621355
domElement,
13631356
tag,

packages/react-dom-bindings/src/events/plugins/ChangeEventPlugin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import {
3535
processDispatchQueue,
3636
accumulateTwoPhaseListeners,
3737
} from '../DOMPluginEventSystem';
38-
import isCustomComponent from '../../shared/isCustomComponent';
38+
import isCustomElement from '../../shared/isCustomElement';
3939

4040
function registerEvents() {
4141
registerTwoPhaseEvent('onChange', [
@@ -312,7 +312,7 @@ function extractEvents(
312312
} else if (
313313
enableCustomElementPropertySupport &&
314314
targetInst &&
315-
isCustomComponent(targetInst.elementType, targetInst.memoizedProps)
315+
isCustomElement(targetInst.elementType, targetInst.memoizedProps)
316316
) {
317317
getTargetInstFunc = getTargetInstForChangeEvent;
318318
}

packages/react-dom-bindings/src/shared/ReactDOMUnknownPropertyHook.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import {BOOLEAN, getPropertyInfo} from './DOMProperty';
99
import {ATTRIBUTE_NAME_CHAR} from './isAttributeNameSafe';
10-
import isCustomComponent from './isCustomComponent';
10+
import isCustomElement from './isCustomElement';
1111
import possibleStandardNames from './possibleStandardNames';
1212
import hasOwnProperty from 'shared/hasOwnProperty';
1313
import {enableCustomElementPropertySupport} from 'shared/ReactFeatureFlags';
@@ -308,7 +308,7 @@ function warnUnknownProperties(type, props, eventRegistry) {
308308
}
309309

310310
export function validateProperties(type, props, eventRegistry) {
311-
if (isCustomComponent(type, props)) {
311+
if (isCustomElement(type, props)) {
312312
return;
313313
}
314314
warnUnknownProperties(type, props, eventRegistry);

packages/react-dom-bindings/src/shared/isCustomComponent.js renamed to packages/react-dom-bindings/src/shared/isCustomElement.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @flow
88
*/
99

10-
function isCustomComponent(tagName: string, props: Object): boolean {
10+
function isCustomElement(tagName: string, props: Object): boolean {
1111
if (tagName.indexOf('-') === -1) {
1212
return typeof props.is === 'string';
1313
}
@@ -30,4 +30,4 @@ function isCustomComponent(tagName: string, props: Object): boolean {
3030
}
3131
}
3232

33-
export default isCustomComponent;
33+
export default isCustomElement;

0 commit comments

Comments
 (0)