Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Unified Diff: LayoutTests/svg/custom/load-image-reparented-in-onload.html

Issue 375923002: Don't dispatch '(SVG)load' to ancestors of <svg:image> after doc. 'load' (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Drop assert_true; use toSVGElement. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/svg/custom/load-image-reparented-in-onload.html
diff --git a/LayoutTests/svg/custom/load-image-reparented-in-onload.html b/LayoutTests/svg/custom/load-image-reparented-in-onload.html
new file mode 100644
index 0000000000000000000000000000000000000000..4966f87785301d5ba1af0ea9e7e2b730bb956865
--- /dev/null
+++ b/LayoutTests/svg/custom/load-image-reparented-in-onload.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+var events = [];
+function logLoadEvent(event) {
+ events.push(event.target.id);
+}
+function reparentAndLogLoadEvent(event) {
+ logLoadEvent(event);
+ var element = event.target;
+ var newParent = element.parentNode.previousSibling.previousSibling;
+ newParent.appendChild(element);
+}
+
+var t = async_test("'load' event fires on parent of element reparented in onload handler.");
+
+window.onload = function() {
+ t.step(function() {
+ assert_equals(events.length, 4);
+ assert_equals(events[0], "inner1");
+ assert_equals(events[1], "image");
+ assert_equals(events[2], "inner2");
+ assert_equals(events[3], "outer");
+ }, 'Verify order and presence of events');
+ t.done();
+};
+</script>
+<svg id="outer" onload="logLoadEvent(evt)">
+ <svg id="inner1" onload="logLoadEvent(evt)"></svg>
+ <svg id="inner2" onload="logLoadEvent(evt)">
+ <image id="image" onload="reparentAndLogLoadEvent(evt)"
+ xlink:href="resources/red-checker.png" width="10" height="10"/>
+ </svg>
+</svg>

Powered by Google App Engine
This is Rietveld 408576698