Open Bug 461578 Opened 16 years ago Updated 2 years ago

Allow doCommand to take an optional event

Categories

(Core :: DOM: Events, defect, P3)

defect

Tracking

()

People

(Reporter: Mardak, Unassigned)

References

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

Details

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.
I don't understand this bug at all.
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
> 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.
(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?
Blocks: 928664
See Also: → 959494
Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.