Skip to content

Clarification on scope of event listener on element after adoption into different document #11795

@TimvdLippe

Description

@TimvdLippe

What is the issue with the HTML Standard?

Servo was crashing when running event listeners after adopting an element from an iframe that was disconnected: servo/servo#36397 With the fix, I wrote a (tentative) test as reported: web-platform-tests/wpt#55454 In both Servo and Firefox, event listeners are lazily compiled and recompiled after adoption into a new document.

However, there is difference in behavior between Chrome and Firefox. Chrome points window in the event listener to the (now removed) iframe.contentWindow. Firefox instead points window to the global of the new document.

Reading https://html.spec.whatwg.org/multipage/webappapis.html#getting-the-current-value-of-the-event-handler the scope is set to Let realm be settings object's realm.. Here, Let settings object be the relevant settings object of document. leads me to believe that the new document is the document. Hence, I think Firefox behavior is correct.

Is that indeed the case or am I missing something else? Is there a preference for one or the other?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions