MCPcopy Index your code
hub / github.com/react/react / isCustomElement

Function isCustomElement

packages/react-dom-bindings/src/shared/isCustomElement.js:10–31  ·  view source on GitHub ↗

* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @flow

(tagName: string, props: Object)

Source from the content-addressed store, hash-verified

8 */
9
10function isCustomElement(tagName: string, props: Object): boolean {
11 if (tagName.indexOf('-') === -1) {
12 return false;
13 }
14 switch (tagName) {
15 // These are reserved SVG and MathML elements.
16 // We don't mind this list too much because we expect it to never grow.
17 // The alternative is to track the namespace in a few places which is convoluted.
18 // https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-core-concepts
19 case 'annotation-xml':
20 case 'color-profile':
21 case 'font-face':
22 case 'font-face-src':
23 case 'font-face-uri':
24 case 'font-face-format':
25 case 'font-face-name':
26 case 'missing-glyph':
27 return false;
28 default:
29 return true;
30 }
31}
32
33export default isCustomElement;

Callers 5

setInitialPropertiesFunction · 0.85
updatePropertiesFunction · 0.85
diffHydratedPropertiesFunction · 0.85
validatePropertiesFunction · 0.85
extractEventsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected