Allow doCommand to take an optional event

NEW
Unassigned

Status

()

Core
DOM: Events
9 years ago
2 years ago

People

(Reporter: Mardak, Unassigned)

Tracking

(Depends on: 1 bug, Blocks: 1 bug)

Trunk
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

9 years ago
Related to bug 246720 where a command's oncommand attribute isn't accessible through javascript without first calling doCommand, the goal of wanting to do oncommand(event) is to pass a custom event to the command.

Another way to get that is if doCommand took in an optional event argument.

Comment 1

9 years ago
I don't understand this bug at all.
(Reporter)

Comment 2

9 years ago
For example, browser has..

<command id="Browser:BackOrBackDuplicate" oncommand="BrowserBack(event);"/>

I want to trigger the command with a specific event such as a mouse click with certain meta/shift/etc keys set true.

So if this bug is fixed, one would be able to do something like cmd.doCommand(keyEvent); cmd.doCommand(mouseEvent); instead of doing

oncommand = new Function("event", cmd.getAttribute("oncommand"));
oncommand.call(cmd, keyEvent);
oncommand.call(cmd, mouseEvent);

So maybe something like..
void nsIDOMXULElement::doCommand([optional] in nsIDOMEvent evt) ?
.oncommand gets called with command event, not with keyEvent or mouseEvent.
So if doCommand is extended, it should take nsIDOMXULCommandEvent, not nsIDOMEvent

Comment 4

9 years ago
> I want to trigger the command with a specific event such as a mouse click with
> certain meta/shift/etc keys set true.

Ah, what you actually want is to have the modifier state initialized.

> So maybe something like..
> void nsIDOMXULElement::doCommand([optional] in nsIDOMEvent evt) ?

Yes, and nsIDOMXULCommandEvent should be extended to have the four modifier properties available.

Comment 5

9 years ago
(In reply to comment #4)
> Yes, and nsIDOMXULCommandEvent should be extended to have the four modifier
> properties available.
It already does! You might want to add the button property though?

Updated

2 years ago
Blocks: 928664
You need to log in before you can comment on or make changes to this bug.