Fix syntax highlighting of quoted <span>s

The approach of the fix in change 331499 missed an edge cases, so we are
reverting it here and at the same time replacing it by something simpler
and more correct.

We just keep parsing and matching of the *escaped* HTML string, but only
do the unescaping when we compute the offset of the range.

Google-Bug-Id: b/225015384
Release-Notes: skip
Change-Id: I6a728c1b3043ea6693ec5427e9fc182422b4b3aa
diff --git a/polygerrit-ui/app/utils/syntax-util_test.ts b/polygerrit-ui/app/utils/syntax-util_test.ts
index 00464df..81cdf57 100644
--- a/polygerrit-ui/app/utils/syntax-util_test.ts
+++ b/polygerrit-ui/app/utils/syntax-util_test.ts
@@ -112,6 +112,28 @@
       );
     });
 
+    test('<span> quoted in a string', async () => {
+      const s = `
+<span class="keyword">const</span> x = <span class="string">&#x27;&lt;span class=&quot;c&quot;&gt;&#x27;</span>;
+<span class="keyword">const</span> y = <span class="string">&#x27;&lt;/span&gt;&#x27;</span>;`;
+
+      assert.deepEqual(highlightedStringToRanges(s), [
+        {ranges: []},
+        {
+          ranges: [
+            {start: 0, length: 5, className: 'keyword'},
+            {start: 10, length: 18, className: 'string'},
+          ],
+        },
+        {
+          ranges: [
+            {start: 0, length: 5, className: 'keyword'},
+            {start: 10, length: 9, className: 'string'},
+          ],
+        },
+      ]);
+    });
+
     test('one complex line with escaped HTML', async () => {
       assert.deepEqual(
         highlightedStringToRanges(