main
js 33 lines 962 Bytes
Raw
1 /**
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 * @flow
8 */
9
10 function 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
33 export default isCustomElement;