1<!DOCTYPE html> 2<title>Click event on an element not in the document</title> 3<script src="/resources/testharness.js"></script> 4<script src="/resources/testharnessreport.js"></script> 5<div id=log></div> 6<script> 7test(function() { 8 var EVENT = "click"; 9 var TARGET = document.createElement("somerandomelement"); 10 var t = async_test("Click event can be dispatched to an element that is not in the document.") 11 TARGET.addEventListener(EVENT, t.step_func(function(evt) { 12 assert_equals(evt.target, TARGET); 13 assert_equals(evt.srcElement, TARGET); 14 t.done(); 15 }), true); 16 var e = document.createEvent("Event"); 17 e.initEvent(EVENT, true, true); 18 TARGET.dispatchEvent(e); 19}); 20</script> 21