oncontextmenu doesn't work with addEventListener

VERIFIED INVALID

Status

()

Core
DOM: Events
VERIFIED INVALID
15 years ago
15 years ago

People

(Reporter: Agustín Fernández, Assigned: saari (gone))

Tracking

Trunk
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

15 years ago
oncontextmenu doesn't work with addEventListener, even if it does work with the
property of the element.

Attaching testcase.

I'm using Mozilla 1.3 so I will submit this as unconfirmed so that somebody
checks if it was fixed since 1.3's release (not likely).
(Reporter)

Comment 1

15 years ago
Created attachment 118406 [details]
Testcase

Comment 2

15 years ago
Dup of bug 180475?
(Reporter)

Comment 3

15 years ago
It's not a dupe, in bug 180475 comment 2 Alex Vincent sais it was not valid
because the two ways of doing it were considered identical (and that is wrong).
I, however, don't say that, and use preventDefault() as he says. The problem is
not just that the menu is not being cancelled, but rather that the handler is
not called.

Here is what Alex Vincent said:

INVALID.  DOM Level 2 Events operates on a different model than this.  With
addEventListener, when the event fires and the event listener is called, the
function receives the event as its first argument.

Returning false does not cancel the event.  You do that by calling the
preventDefault() method of the event.  stopPropagation() works also, in some
circumstances.
(Reporter)

Comment 4

15 years ago
Well, I downloaded a recent build and the problem is still present:

CONFIRMED with Windows XP, build 2003040808.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Sorry, but this testcase is INVALID.  You used 'oncontextmenu' rather than
'contextmenu'.  Note that when using addEventListener, the event name itself
should be given, without the prefixing 'on'.  Once you correct that, the
testcase works as expected.
Status: NEW → RESOLVED
Last Resolved: 15 years ago
Resolution: --- → INVALID
Created attachment 121329 [details]
Corrected testcase
Attachment #118406 - Attachment is obsolete: true
(Reporter)

Comment 7

15 years ago
Sorry for the confusion. VERIFIED INVALID.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.