Index: third_party/WebKit/LayoutTests/fast/css/invalidation/class-invalidation-after-adding-sheet.html |
diff --git a/third_party/WebKit/LayoutTests/fast/css/invalidation/class-invalidation-after-adding-sheet.html b/third_party/WebKit/LayoutTests/fast/css/invalidation/class-invalidation-after-adding-sheet.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5d488a7cc068f63c61903c28f2ed053ca099e80f |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/fast/css/invalidation/class-invalidation-after-adding-sheet.html |
@@ -0,0 +1,16 @@ |
+<!DOCTYPE html> |
+<script src="../../../resources/testharness.js"></script> |
+<script src="../../../resources/testharnessreport.js"></script> |
+<div id="d1">This text should be green</div> |
+<script> |
+ test(() => { |
+ document.body.offsetTop; |
+ assert_equals(getComputedStyle(d1).color, "rgb(0, 0, 0)", "Precondition - text is black."); |
+ |
+ var sheet = document.createElement("style"); |
+ sheet.innerText = ".green { color: green }" |
+ document.head.appendChild(sheet); |
+ d1.className = "green"; |
+ assert_equals(getComputedStyle(d1).color, "rgb(0, 128, 0)", "Check that d1 with class 'green' is green."); |
+ }, "Check that style invalidation works when class is changed immediately after adding sheet with rule for class."); |
+</script> |