From 3c2c7ce1e270561dc49831c8157e17c3a62ca14a Mon Sep 17 00:00:00 2001 From: Moonchild Date: Thu, 19 Jun 2025 12:55:54 +0200 Subject: [PATCH] No issue - Escape `<` and `>` in element attribute values. Per spec, extend escaping of attribute value characters to include `<` and `>`. We already did this for text fragments, and it makes sense to apply the same to attribute values. We are at parity with mainstream that default-escape attribute values this way in current releases. --- dom/base/nsContentUtils.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index ab7eb59774..fb4eee8f0e 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -9359,6 +9359,12 @@ private: case 0x00A0: aOut.AppendLiteral(" "); break; + case '<': + aOut.AppendLiteral("<"); + break; + case '>': + aOut.AppendLiteral(">"); + break; default: aOut.Append(*c); break; @@ -9500,6 +9506,12 @@ AppendEncodedAttributeValue(nsAutoString* aValue, StringBuilder& aBuilder) case 0x00A0: extraSpaceNeeded += ArrayLength(" ") - 2; break; + case '<': + extraSpaceNeeded += ArrayLength("<") - 2; + break; + case '>': + extraSpaceNeeded += ArrayLength(">") - 2; + break; default: break; }