Closed Bug 1490884 Opened 7 years ago Closed 7 years ago

"paste" event target may be a text node

Categories

(Core :: DOM: Events, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla64
Tracking Status
firefox64 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

Details

Attachments

(1 file)

"paste" event target may be a text node since nsCopySupport::FireClipboardEvent() decides the event target from selection start container which may be a text node. However, Clipboard API and events defines: https://www.w3.org/TR/clipboard-apis/#fire-a-clipboard-event > Let target be set as follows: > > If the context is editable, then > > Set target to be the element that contains the start of the selection in document order, or the body element if there is no selection or cursor. > > Else, if the context is not editable, then > > Set target to be the element that contains the start of the selection in document order, or the body element if there is no selection or cursor. > So, the target should always be an element. Additionally, when there is no selection, we're using nsCopySupport::FireClipboardEvent() element but it should be <body> or <frameset> element according to this definition.
Clipboard API and events spec, event target of clipboard events should always be an element node which contains the selection start and if there is no Selection ranges, should use <body> or <frameset> of the document: https://www.w3.org/TR/clipboard-apis/#fire-a-clipboard-event This patch does not include the test for the latter because I have no idea how to avoid adjusting selection adjustments immediately before pasting in editor's middle click event handler or enable copy or paste commands without selection ranges.
Comment on attachment 9008634 [details] Bug 1490884 - Make nsCopySupport set event target of clipboard events to conform to Clipboard API and events spec Olli Pettay [:smaug] has approved the revision.
Attachment #9008634 - Flags: review+
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/b4d300bcaf99 Make nsCopySupport set event target of clipboard events to conform to Clipboard API and events spec r=smaug
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla64
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: