|
1 |
| -import { is_void } from '../../../shared/utils/names'; |
| 1 | +import { is_html, is_svg, is_void } from '../../../shared/utils/names'; |
2 | 2 | import Node from './shared/Node';
|
3 | 3 | import Attribute from './Attribute';
|
4 | 4 | import Binding from './Binding';
|
@@ -26,8 +26,6 @@ import compiler_errors from '../compiler_errors';
|
26 | 26 | import { ARIARoleDefintionKey, roles, aria, ARIAPropertyDefinition, ARIAProperty } from 'aria-query';
|
27 | 27 | import { is_interactive_element, is_non_interactive_roles, is_presentation_role } from '../utils/a11y';
|
28 | 28 |
|
29 |
| -const svg = /^(?:altGlyph|altGlyphDef|altGlyphItem|animate|animateColor|animateMotion|animateTransform|circle|clipPath|color-profile|cursor|defs|desc|discard|ellipse|feBlend|feColorMatrix|feComponentTransfer|feComposite|feConvolveMatrix|feDiffuseLighting|feDisplacementMap|feDistantLight|feDropShadow|feFlood|feFuncA|feFuncB|feFuncG|feFuncR|feGaussianBlur|feImage|feMerge|feMergeNode|feMorphology|feOffset|fePointLight|feSpecularLighting|feSpotLight|feTile|feTurbulence|filter|font|font-face|font-face-format|font-face-name|font-face-src|font-face-uri|foreignObject|g|glyph|glyphRef|hatch|hatchpath|hkern|image|line|linearGradient|marker|mask|mesh|meshgradient|meshpatch|meshrow|metadata|missing-glyph|mpath|path|pattern|polygon|polyline|radialGradient|rect|set|solidcolor|stop|svg|switch|symbol|text|textPath|tref|tspan|unknown|use|view|vkern)$/; |
30 |
| - |
31 | 29 | const aria_attributes = 'activedescendant atomic autocomplete busy checked colcount colindex colspan controls current describedby description details disabled dropeffect errormessage expanded flowto grabbed haspopup hidden invalid keyshortcuts label labelledby level live modal multiline multiselectable orientation owns placeholder posinset pressed readonly relevant required roledescription rowcount rowindex rowspan selected setsize sort valuemax valuemin valuenow valuetext'.split(' ');
|
32 | 30 | const aria_attribute_set = new Set(aria_attributes);
|
33 | 31 |
|
@@ -166,13 +164,13 @@ function get_namespace(parent: Element, element: Element, explicit_namespace: st
|
166 | 164 | const parent_element = parent.find_nearest(/^Element/);
|
167 | 165 |
|
168 | 166 | if (!parent_element) {
|
169 |
| - return explicit_namespace || (svg.test(element.name) |
| 167 | + return explicit_namespace || (is_svg(element.name) |
170 | 168 | ? namespaces.svg
|
171 | 169 | : null);
|
172 | 170 | }
|
173 | 171 |
|
174 | 172 | if (parent_element.namespace !== namespaces.foreign) {
|
175 |
| - if (svg.test(element.name.toLowerCase())) return namespaces.svg; |
| 173 | + if (is_svg(element.name.toLowerCase())) return namespaces.svg; |
176 | 174 | if (parent_element.name.toLowerCase() === 'foreignobject') return null;
|
177 | 175 | }
|
178 | 176 |
|
@@ -373,7 +371,7 @@ export default class Element extends Node {
|
373 | 371 | }
|
374 | 372 |
|
375 | 373 | validate() {
|
376 |
| - if (this.component.var_lookup.has(this.name) && this.component.var_lookup.get(this.name).imported) { |
| 374 | + if (this.component.var_lookup.has(this.name) && this.component.var_lookup.get(this.name).imported && !is_svg(this.name) && !is_html(this.name)) { |
377 | 375 | this.component.warn(this, compiler_warnings.component_name_lowercase(this.name));
|
378 | 376 | }
|
379 | 377 |
|
@@ -827,7 +825,7 @@ export default class Element extends Node {
|
827 | 825 | } else if (dimensions.test(name)) {
|
828 | 826 | if (this.name === 'svg' && (name === 'offsetWidth' || name === 'offsetHeight')) {
|
829 | 827 | return component.error(binding, compiler_errors.invalid_binding_on(binding.name, `<svg>. Use '${name.replace('offset', 'client')}' instead`));
|
830 |
| - } else if (svg.test(this.name)) { |
| 828 | + } else if (is_svg(this.name)) { |
831 | 829 | return component.error(binding, compiler_errors.invalid_binding_on(binding.name, 'SVG elements'));
|
832 | 830 | } else if (is_void(this.name)) {
|
833 | 831 | return component.error(binding, compiler_errors.invalid_binding_on(binding.name, `void elements like <${this.name}>. Use a wrapper element instead`));
|
|
0 commit comments