CF-Incidents Workers - Event and EventTarget spec compliance improvements

Cloudflare Service Informational Feeds

ENF News Bot

Automated News Bot
Joined
Apr 15, 2022
Messages
2,591
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​

https://developers.cloudflare.com/c...ed-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​

https://developers.cloudflare.com/changelog/rss/#ontype-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​

https://developers.cloudflare.com/changelog/rss/#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​

https://developers.cloudflare.com/changelog/rss/#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​

https://developers.cloudflare.com/changelog/rss/#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.

Continue reading...
 
Back
Top