SVG examples should be written in proper XML syntax
- Dominant language
- Markdown
- Stars
- 11k
- Forks
- 23.2k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 331
Description
### MDN URL
https://developer.mozilla.org/en-US/docs/Web/SVG/Element/style
### What specific section or headline is this issue about?
Description and Example
### What information was incorrect, unhelpful, or incomplete?
```html
...
```
### What did you expect to see?
```html
<![CDATA[
...
]]
```
### Do you have any supporting links, references, or citations?
https://www.w3.org/TR/SVG11/styling.html#StyleElementExample
### Do you have anything more you want to share?
Without this ``, `&`, and `"` characters which are used for **selectors**, strings or content inside strings !
What's worse is that, without this encapsulation, your SVG will be rejected by FireFox's XML-parser (with error), maybe other browsers too have not tried.
Perhaps Firefox and/or some specification should explicitly allow usage of those characters inside the contents of the SVG `` tag without the need to "escape" them using char-entities like `&` for `&`...
Example SVG that will trigger the parser-error on each nesting level, if im correct: _(Have only tested the `&` one)_
```svg
<svg>
<style>
selector1 {
&#selector2 {
> selector3 {
...
}
}
}
...
```
- PS: Maybe good info to checkout also wrt. problems with external stylesheets in SVG: https://stackoverflow.com/staging-ground/79378292
### MDN metadata
Page report details
* Folder: `en-us/web/svg/element/style`
* MDN URL: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/style
* GitHub URL: https://github.com/mdn/content/blob/main/files/en-us/web/svg/element/style/index.md
* Last commit: https://github.com/mdn/content/commit/bc780f1de369fc7f14c73bbdccdeeb8e375cc93e
* Document last modified: 2024-12-22T22:57:14.000Z
Contributor guide
Assessment
This issue has not been assessed yet.