Format <script> inside SVG (#14400)
This commit is contained in:
1 parent
686320a88c
commit
ecfa324b69
9 files changed
+350
-33
No files matched your search
@@ -0,0 +1,38 @@
|
||||
#### Format `<script>` inside SVG (#14400 by @fisker)
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
```html
|
||||
<!-- Input -->
|
||||
<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
|
||||
<script>
|
||||
document.addEventListener(
|
||||
'DOMContentLoaded', () => {
|
||||
const element = document.getElementById('foo')
|
||||
if (element) {
|
||||
element.fillStyle = 'currentColor'
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</svg>
|
||||
|
||||
<!-- Prettier stable -->
|
||||
<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
|
||||
<script>
|
||||
document.addEventListener( 'DOMContentLoaded', () => { const element =
|
||||
document.getElementById('foo') if (element) { element.fillStyle =
|
||||
'currentColor' } });
|
||||
</script>
|
||||
</svg>
|
||||
|
||||
<!-- Prettier main -->
|
||||
<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
const element = document.getElementById("foo");
|
||||
if (element) {
|
||||
element.fillStyle = "currentColor";
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</svg>
|
||||
```
|
||||
Reference in new issue
Block a user