Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: escape foreign style tag content when serializing HTML5
Normally, a `style` tag is considered to be a raw text element, meaning `<` is parsed as part of a possible "tag start" token, and is serialized literally (and not rendered as an escaped character reference `<`). However, when appearing in either SVG or MathML foreign content, a `style` tag should *not* be considered a raw text element, and should be escaped when serialized. libgumbo is parsing this case correctly, but our HTML5 serialization code does not escape the content. This commit updates the static `is_one_of()` C function to consider the namespace of the parent node as well as the tag's local name when deciding whether the tag matches the list of HTML elements, so that a `style` tag in foreign content will *not* match, but a `style` tag in HTML content will match. (cherry picked from commit 44e3a74aff2c93873c82d55db8f08912f4e69d59)
- Loading branch information