<!DOCTYPE html>
<meta charset="utf-8">
<title>window.event is [Replaceable]</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<script>
"use strict";

test(() => {
  window.event = "foo";

  assert_equals(window.event, "foo");
}, "Setting window.event replaces it");

test(() => {
  const target = document.createElement("div");
  assert_equals(window.event, "foo", "Still set before dispatch");

  const clickEvent = new Event("click");
  let fire