fix: allow self-closing tags within math namespace (#15761)

fixes #15757
pull/15756/head
Simon H 5 months ago committed by GitHub
parent de4376235c
commit bdf033e30f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: allow self-closing tags within math namespace

@ -173,7 +173,8 @@ export function RegularElement(node, context) {
if ( if (
context.state.analysis.source[node.end - 2] === '/' && context.state.analysis.source[node.end - 2] === '/' &&
!is_void(node_name) && !is_void(node_name) &&
!is_svg(node_name) !is_svg(node_name) &&
!is_mathml(node_name)
) { ) {
w.element_invalid_self_closing_tag(node, node.name); w.element_invalid_self_closing_tag(node, node.name);
} }

@ -1,6 +1,7 @@
<!-- valid --> <!-- valid -->
<link /> <link />
<svg><g /></svg> <svg><g /></svg>
<math><mspace /></math>
<enhanced:img /> <enhanced:img />

@ -3,11 +3,11 @@
"code": "element_invalid_self_closing_tag", "code": "element_invalid_self_closing_tag",
"message": "Self-closing HTML tags for non-void elements are ambiguous — use `<div ...></div>` rather than `<div ... />`", "message": "Self-closing HTML tags for non-void elements are ambiguous — use `<div ...></div>` rather than `<div ... />`",
"start": { "start": {
"line": 8, "line": 9,
"column": 0 "column": 0
}, },
"end": { "end": {
"line": 8, "line": 9,
"column": 7 "column": 7
} }
}, },
@ -15,11 +15,11 @@
"code": "element_invalid_self_closing_tag", "code": "element_invalid_self_closing_tag",
"message": "Self-closing HTML tags for non-void elements are ambiguous — use `<my-thing ...></my-thing>` rather than `<my-thing ... />`", "message": "Self-closing HTML tags for non-void elements are ambiguous — use `<my-thing ...></my-thing>` rather than `<my-thing ... />`",
"start": { "start": {
"line": 9, "line": 10,
"column": 0 "column": 0
}, },
"end": { "end": {
"line": 9, "line": 10,
"column": 12 "column": 12
} }
} }

Loading…
Cancel
Save