summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/syntax/parsing/common.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/html/syntax/parsing/common.js
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/html/syntax/parsing/common.js')
-rw-r--r--testing/web-platform/tests/html/syntax/parsing/common.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/syntax/parsing/common.js b/testing/web-platform/tests/html/syntax/parsing/common.js
new file mode 100644
index 0000000000..b3ac9ece70
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/parsing/common.js
@@ -0,0 +1,24 @@
+function mark_diffs(expected, actual) {
+ var expected_lines = expected.split("\n");
+ var actual_lines = actual.split("\n");
+
+ var max_length = Math.max(expected_lines.length, actual_lines.length);
+
+ var expected_diff = ["code", {}];
+ var actual_diff = ["code", {}];
+
+ for (var i=0; i<max_length; i++) {
+ if (expected_lines[i] === actual_lines[i]) {
+ expected_diff.push(expected_lines[i] + "\n");
+ actual_diff.push(actual_lines[i] + "\n");
+ } else {
+ if (expected_lines[i]) {
+ expected_diff.push(["span", {style:"color:red"}, expected_lines[i] + "\n"]);
+ }
+ if (actual_lines[i]) {
+ actual_diff.push(["span", {style:"color:red"}, actual_lines[i] + "\n"]);
+ }
+ }
+ }
+ return [expected_diff, actual_diff];
+}