mirror of https://github.com/sveltejs/svelte
feat: MathML support (#11387)
* feat: MathML support - Add support for MathML namespace - Auto-infer MathML namespace * tweak * DRY out * note to self --------- Co-authored-by: Rich Harris <rich.harris@vercel.com>pull/11396/head
parent
fe56c7fd2e
commit
8be6fdde54
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"svelte": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
feat: MathML support
|
Before Width: | Height: | Size: 109 B After Width: | Height: | Size: 140 B |
@ -0,0 +1,19 @@
|
|||||||
|
<mrow></mrow>
|
||||||
|
|
||||||
|
{#if true}
|
||||||
|
<mrow></mrow>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#each Array(2).fill(0) as item, idx}
|
||||||
|
<mrow></mrow>
|
||||||
|
{/each}
|
||||||
|
|
||||||
|
{@html '<mrow></mrow>'}
|
||||||
|
|
||||||
|
{@render test()}
|
||||||
|
|
||||||
|
{#snippet test(text)}
|
||||||
|
<mrow></mrow>
|
||||||
|
{/snippet}
|
||||||
|
|
||||||
|
<!-- comment should not infer html namespace -->
|
@ -0,0 +1,27 @@
|
|||||||
|
import { test, ok } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
html: `
|
||||||
|
<math>
|
||||||
|
<mrow></mrow>
|
||||||
|
<mrow></mrow>
|
||||||
|
<mrow></mrow>
|
||||||
|
<mrow></mrow>
|
||||||
|
<mrow></mrow>
|
||||||
|
<mrow></mrow>
|
||||||
|
</math>
|
||||||
|
`,
|
||||||
|
test({ assert, target }) {
|
||||||
|
const math = target.querySelector('math');
|
||||||
|
ok(math);
|
||||||
|
|
||||||
|
assert.equal(math.namespaceURI, 'http://www.w3.org/1998/Math/MathML');
|
||||||
|
|
||||||
|
const mrow_elements = target.querySelectorAll('mrow');
|
||||||
|
|
||||||
|
assert.equal(mrow_elements.length, 6);
|
||||||
|
|
||||||
|
for (const { namespaceURI } of mrow_elements)
|
||||||
|
assert.equal(namespaceURI, 'http://www.w3.org/1998/Math/MathML');
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1,7 @@
|
|||||||
|
<script>
|
||||||
|
import Wrapper from "./Wrapper.svelte";
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<math>
|
||||||
|
<Wrapper />
|
||||||
|
</math>
|
Loading…
Reference in new issue