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 (
context.state.analysis.source[node.end - 2] === '/' &&
!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);
}

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

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

Loading…
Cancel
Save