blob: c4d1fcfc0212a4c8569ac86374a43dcddcdd05ba [file] [log] [blame]
<!DOCTYPE html>
<title> Event dispatch and DOM event flow </title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id=log></div>
<table id="table" border="1" style="display: none">
<tbody id="table-body">
<tr id="table-row">
<td id="table-cell">Shady Grove</td>
<tr id="parent">
<td id="target">Over the river, Charlie</td>
var EVENT = "foo";
var TARGET = document.getElementById("target");
var PARENT = document.getElementById("parent");
var TBODY = document.getElementById("table-body");
var TABLE = document.getElementById("table");
var BODY = document.body;
var HTML = document.documentElement;
var CurrentTargets = [window, document, HTML, BODY, TABLE, TBODY, PARENT, TARGET];
var ExpectResult = CurrentTargets.concat([TARGET, PARENT, TBODY, TABLE, BODY, HTML, document, window]);
var ActualResult = [];
var ExpectPhases = [1,1,1,1,1,1,1,2,2,3,3,3,3,3,3,3,];
var ActualPhases = [];
var description = "Test Description: Dispatch an event in a DOM tree using the DOM event flow.";
for (var i=0; i < CurrentTargets.length; i++)
CurrentTargets[i].addEventListener(EVENT, TestEvent, true);
CurrentTargets[i].addEventListener(EVENT, TestEvent, false);
var evt = document.createEvent("Event");
evt.initEvent(EVENT, true, true);
assert_array_equals(ActualResult, ExpectResult, "ActualResult");
assert_array_equals(ActualPhases, ExpectPhases, "ActualPhases");
}, description);
function TestEvent(evt)