---
description: Several fixes bring Event subclasses, event handler attributes, and MessagePort closer to their web platform specifications.
title: Event and EventTarget spec compliance improvements
image: https://developers.cloudflare.com/changelog/post/2026-08-19-event-spec-compliance/og.png?v=715753afd8cc1cd8
---

[Skip to content](#main-content)

[View RSS feeds](https://developers.cloudflare.com/fundamentals/new-features/available-rss-feeds/) [ Subscribe to RSS](https://developers.cloudflare.com/changelog/rss/index.xml)

[Back to all posts](https://developers.cloudflare.com/changelog)

August 19, 2026

## Event and EventTarget spec compliance improvements

[Workers](https://developers.cloudflare.com/workers/)

Copy as Markdown| [View as Markdown](https://developers.cloudflare.com/changelog/post/2026-08-19-event-spec-compliance/index.md)| [Agent setup](https://developers.cloudflare.com/agent-setup/)

Several improvements bring the Workers runtime's `Event`, `EventTarget`, and related APIs closer to their web platform specifications.

#### `isTrusted` is now correct for user-constructed events

User-constructed event subclasses (`new MessageEvent(...)`, `new CustomEvent(...)`, `new ErrorEvent(...)`, `new CloseEvent(...)`) now correctly report `isTrusted` as `false`. Previously, these incorrectly reported `isTrusted` as `true`.

#### `on<type>` handlers fire in registration order

Event handler attributes such as `onmessage` and `onabort` now fire in their registration order relative to `addEventListener()` calls, matching browser behavior. Previously, `on<type>` handlers always fired before any `addEventListener()` listeners regardless of when they were assigned.

#### `MessageEvent` constructor improvements

`new MessageEvent(type)` now works without providing an init object — `data` defaults to `null` per spec. The `MessageEventInit` dictionary also now supports the full spec surface: `origin`, `lastEventId`, `source`, and `ports`, in addition to `data`.

#### `CloseEvent` and `ErrorEvent` constructor improvements

The `CloseEventInit` and `ErrorEventInit` dictionaries now accept the standard `EventInit` members `bubbles`, `cancelable`, and `composed`.

#### `MessagePort` starts on any `message` listener

Adding a `message` event listener to a `MessagePort` via `addEventListener("message", ...)` now starts the port, matching browser behavior. Previously, only assigning `onmessage` would start the port.

```json
{"@context":"https://schema.org","@type":"BlogPosting","@id":"https://developers.cloudflare.com/changelog/post/2026-08-19-event-spec-compliance/#page","headline":"Event and EventTarget spec compliance improvements","description":"Several fixes bring Event subclasses, event handler attributes, and MessagePort closer to their web platform specifications.","url":"https://developers.cloudflare.com/changelog/post/2026-08-19-event-spec-compliance/","inLanguage":"en","image":"https://developers.cloudflare.com/changelog/post/2026-08-19-event-spec-compliance/og.png?v=715753afd8cc1cd8","dateModified":"2026-08-19","datePublished":"2026-08-19","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
```
