Closed Bug 199117 Opened 21 years ago Closed 21 years ago

oncontextmenu doesn't work with addEventListener

Categories

(Core :: DOM: Events, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

VERIFIED INVALID

People

(Reporter: agustinmfernandez, Assigned: saari)

Details

Attachments

(1 file, 1 obsolete file)

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).
Attached file Testcase (obsolete) —
Dup of bug 180475?
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.
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
Closed: 21 years ago
Resolution: --- → INVALID
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.

Attachment

General

Created:
Updated:
Size: