* 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)
| 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; |
no outgoing calls
no test coverage detected