[Webkit-unassigned] [Bug 62518] New: If an Event Listener is a Function, It Should be Called and Not Checked for handleEvent

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Jun 12 15:03:48 PDT 2011


https://bugs.webkit.org/show_bug.cgi?id=62518

           Summary: If an Event Listener is a Function, It Should be
                    Called and Not Checked for handleEvent
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: All
        OS/Version: All
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: WebCore JavaScript
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: rob at robbrackett.com


Created an attachment (id=96892)
 --> (https://bugs.webkit.org/attachment.cgi?id=96892&action=review)
Layout Test for Event Listener Functions that Implement the EventListener Interface

When the listener passed to addEventListener() is a function, it should be called when the event occurs. The listener function should not be tested for adherence to the EventListener interface and have its handleEvent() method called if present.

The DOM Level 2 Events spec does not address this issue (in the ECMAScript interface, it only allows functions as listeners). The DOM Level 3 Events spec, though not yet a working draft, appears to indicate that the above described behavior is correct, though it is not extraordinarily clear. It says,

“The listener parameter must be either an object that implements the EventListener interface, or a function. If listener is a function then it must be used as the callback for the event; otherwise, if listener implements EventTarget, then its handleEvent method must be used as the callback.” (see the spec at http://www.w3.org/TR/2011/WD-DOM-Level-3-Events-20110531/#events-EventTarget-addEventListener)

In any case, all other major browsers (Firefox, Opera, and even Chrome) implement it this way, so standard WebKit with JavaScriptCore should probably strive for parity here.

As a note, I think the current behavior is much nicer than this, but interoperability is probably more important.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list