Open Bug 741193 Opened 12 years ago Updated 3 years ago

input events for contenteditable don't expose .command or .value

Categories

(Core :: DOM: Editor, defect, P5)

defect

Tracking

()

People

(Reporter: ayg, Unassigned)

References

Details

Attachments

(1 file)

Tests, which I just updated to be more useful/correct:

http://dvcs.w3.org/hg/editing/raw-file/tip/conformancetest/event.html

A bunch of them are related to beforeinput, but there are some failures like:

"""
Fail	Simple editable div: input event, uncanceled	assert_equals: e.command expected "bold" but got undefined
"""

The spec says that the event should have .command and .value properties.  It needs to implement an EditingInputEvent interface:

http://dvcs.w3.org/hg/editing/raw-file/tip/editing.html#methods-to-query-and-execute-commands
I cargo-culted the interface definition from the hashchange event code and then repeatedly fixed compile errors.  So this compiles, and window.EditingInputEvent exists and you can construct the events, but nothing in the code ever fires them.  How should I go about firing them, given that we need to know the command/value?  I'm not sure how to actually construct the event object properly in C++, nor where I should put it.  The spec says it should go in the execCommand() code itself, but that might not make sense for Gecko.

(beforeinput has to go in the execCommand code, of course, when it's implemented.)
Attachment #611278 - Flags: feedback?(masayuki)
If you implement the new event without new event struct, perhaps, you can use nsIPresShell::HandleDOMEventWithTarget() for dispatching the event.
http://mxr.mozilla.org/mozilla-central/source/layout/base/nsIPresShell.h#730

And also, you can use nsEventDipsatcher::CreateEvent() for constructing new event.
http://mxr.mozilla.org/mozilla-central/source/content/events/public/nsEventDispatcher.h#270

However, I've never used such approach yet, so, there might be better way which I don't know. (I've always made new event struct in nsGUIEvent.h because I usually don't work on non-native complex event.)

Um, how to get command/value at dispatching input event is very difficult issue. I guess that we need to store it in the member of nsEditor like mHandlingTrustedAction. And I'm not sure what is the best behavior for undo/redo command because they do other command(s)...
You should be able to fire this event both from the execCommand call and the edit action observer.  That way if you see an input event coming from a user, you'd initialize those values to empty, and otherwise disable the code to fire the event from the edit action observer, and fire the event from execCommand directly.
I'm probably not going to work on this for now.  Maybe I'll revisit it later, if no one else has.
Assignee: ayg → nobody
Status: ASSIGNED → NEW

Bulk-downgrade of unassigned, untouched DOM/Storage bug's priority.

If you have reason to believe, this is wrong, please write a comment and ni :jstutte.

Severity: normal → S4
Priority: -- → P5
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: