WIP tests for text/css link quirk
diff --git a/html/semantics/links/downloading-resources/.gitkeep b/html/semantics/links/downloading-resources/.gitkeep
deleted file mode 100644
index e69de29..0000000
--- a/html/semantics/links/downloading-resources/.gitkeep
+++ /dev/null
diff --git a/html/semantics/links/downloading-resources/contains.json b/html/semantics/links/downloading-resources/contains.json
deleted file mode 100644
index b67f855..0000000
--- a/html/semantics/links/downloading-resources/contains.json
+++ /dev/null
@@ -1,6 +0,0 @@
-[
-    {
-        "id": "hyperlink-auditing",
-        "original_id": "hyperlink-auditing"
-    }
-]
\ No newline at end of file
diff --git a/html/semantics/links/downloading-resources/quirks-mode-text-css.html b/html/semantics/links/downloading-resources/quirks-mode-text-css.html
new file mode 100644
index 0000000..ed3b834
--- /dev/null
+++ b/html/semantics/links/downloading-resources/quirks-mode-text-css.html
@@ -0,0 +1,110 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>text/css quirk, load, and error events</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<script>
+"use strict";
+window.quirksLoaded = new Promise(resolve => {
+  window.resolveQuirksLoaded = resolve;
+});
+
+window.noQuirksLoaded = new Promise(resolve => {
+  window.resolveNoQuirksLoaded = resolve;
+});
+</script>
+
+<iframe id="quirks" src="resources/quirks-mode.html" onload="resolveQuirksLoaded()"></iframe>
+<iframe id="no-quirks" src="resources/no-quirks-mode.html" onload="resolveNoQuirksLoaded()"></iframe>
+
+<script>
+"use strict";
+
+promise_test(async t => {
+  await window.quirksLoaded;
+  const { contentDocument } = document.querySelector("#quirks");
+  assert_equals(contentDocument.compatMode, "BackCompat", "Sanity check: the document must be in quirks mode");
+
+  const link = document.createElement("link");
+  link.rel = "stylesheet";
+  link.href = "not-css.txt?1";
+
+  const returnValue = new Promise(resolve => {
+    link.onerror = t.unreached_func("error event must not be fired");
+    link.onload = () => resolve();
+  });
+
+  contentDocument.body.appendChild(link);
+  return returnValue;
+}, "load event for non-text/css in a quirks document");
+
+promise_test(async t => {
+  await window.noQuirksLoaded;
+  const { contentDocument } = document.querySelector("#no-quirks");
+  assert_equals(contentDocument.compatMode, "CSS1Compat", "Sanity check: the document must be in no-quirks mode");
+
+  const link = document.createElement("link");
+  link.rel = "stylesheet";
+  link.href = "not-css.txt?2";
+
+  const returnValue = new Promise(resolve => {
+    link.onerror = () => resolve();
+    link.onload = t.unreached_func("load event must not be fired");
+  });
+
+  contentDocument.body.appendChild(link);
+  return returnValue;
+}, "error event for non-text/css in a no-quirks document");
+
+promise_test(async t => {
+  await window.quirksLoaded;
+  await window.noQuirksLoaded;
+  const quirksDocument = document.querySelector("#quirks").contentDocument;
+  const noQuirksDocument = document.querySelector("#no-quirks").contentDocument;
+  assert_equals(quirksDocument.compatMode, "BackCompat", "Sanity check: the document must be in quirks mode");
+  assert_equals(noQuirksDocument.compatMode, "CSS1Compat", "Sanity check: the document must be in no-quirks mode");
+
+  const link = document.createElement("link");
+  link.rel = "stylesheet";
+  link.href = "not-css.txt?3";
+
+  const returnValue = new Promise(resolve => {
+    link.onload = t.step_func(() => {
+      link.onload = t.unreached_func("load event must not be fired yet");
+      link.onerror = () => resolve();
+    });
+    link.onerror = t.unreached_func("error event must not be fired yet");
+  });
+
+  quirksDocument.body.appendChild(link);
+  noQuirksDocument.body.appendChild(link);
+  return returnValue;
+}, "load, then error event for moving non-text/css from a quirks to a no-quirks document");
+
+promise_test(async t => {
+  await window.quirksLoaded;
+  await window.noQuirksLoaded;
+  const quirksDocument = document.querySelector("#quirks").contentDocument;
+  const noQuirksDocument = document.querySelector("#no-quirks").contentDocument;
+  assert_equals(quirksDocument.compatMode, "BackCompat", "Sanity check: the document must be in quirks mode");
+  assert_equals(noQuirksDocument.compatMode, "CSS1Compat", "Sanity check: the document must be in no-quirks mode");
+
+  const link = document.createElement("link");
+  link.rel = "stylesheet";
+  link.href = "not-css.txt?3";
+
+  const returnValue = new Promise(resolve => {
+    link.onload = t.unreached_func("load event must not be fired yet");
+    link.onerror = t.step_func(() => {
+      link.onload = () => resolve();
+      link.onerror = t.unreached_func("error event must not be fired yet");
+    });
+  });
+
+  noQuirksDocument.body.appendChild(link);
+  quirksDocument.body.appendChild(link);
+  return returnValue;
+}, "error, then load event for moving non-text/css from a no-quirks to a quirks document");
+
+</script>
diff --git a/html/semantics/links/downloading-resources/resources/no-quirks-mode.html b/html/semantics/links/downloading-resources/resources/no-quirks-mode.html
new file mode 100644
index 0000000..84f43b3
--- /dev/null
+++ b/html/semantics/links/downloading-resources/resources/no-quirks-mode.html
@@ -0,0 +1,2 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
diff --git a/html/semantics/links/downloading-resources/resources/not-css.txt b/html/semantics/links/downloading-resources/resources/not-css.txt
new file mode 100644
index 0000000..19a7f1a
--- /dev/null
+++ b/html/semantics/links/downloading-resources/resources/not-css.txt
@@ -0,0 +1 @@
+not-css.txt
diff --git a/html/semantics/links/downloading-resources/resources/quirks-mode.html b/html/semantics/links/downloading-resources/resources/quirks-mode.html
new file mode 100644
index 0000000..10957f8
--- /dev/null
+++ b/html/semantics/links/downloading-resources/resources/quirks-mode.html
@@ -0,0 +1,2 @@
+<!DOCTYPE not-html>
+<meta charset="utf-8">