11cb0ef41Sopenharmony_ci<!DOCTYPE html> 21cb0ef41Sopenharmony_ci<title>Click event on an element not in the document</title> 31cb0ef41Sopenharmony_ci<script src="/resources/testharness.js"></script> 41cb0ef41Sopenharmony_ci<script src="/resources/testharnessreport.js"></script> 51cb0ef41Sopenharmony_ci<div id=log></div> 61cb0ef41Sopenharmony_ci<script> 71cb0ef41Sopenharmony_citest(function() { 81cb0ef41Sopenharmony_ci var EVENT = "click"; 91cb0ef41Sopenharmony_ci var TARGET = document.createElement("somerandomelement"); 101cb0ef41Sopenharmony_ci var t = async_test("Click event can be dispatched to an element that is not in the document.") 111cb0ef41Sopenharmony_ci TARGET.addEventListener(EVENT, t.step_func(function(evt) { 121cb0ef41Sopenharmony_ci assert_equals(evt.target, TARGET); 131cb0ef41Sopenharmony_ci assert_equals(evt.srcElement, TARGET); 141cb0ef41Sopenharmony_ci t.done(); 151cb0ef41Sopenharmony_ci }), true); 161cb0ef41Sopenharmony_ci var e = document.createEvent("Event"); 171cb0ef41Sopenharmony_ci e.initEvent(EVENT, true, true); 181cb0ef41Sopenharmony_ci TARGET.dispatchEvent(e); 191cb0ef41Sopenharmony_ci}); 201cb0ef41Sopenharmony_ci</script> 21