Closed Bug 410858 Opened 17 years ago Closed 17 years ago

onbeforecopy / cut / paste events fire way too often

Categories

(Core :: DOM: Events, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: dholbert, Unassigned)

References

Details

Attachments

(2 files)

We fire onbeforecopy / cut / paste events way more frequently than IE does. As I understand it, we only implement these onbeforexxx handlers for compatibility with IE, so correct behavior should be to match what IE does here. (Feel free to stick this in a different component if appropriate -- I'm not sure 'event handling' is the correct spot for it.)
(In reply to comment #0) > We fire onbeforecopy / cut / paste events way more frequently than IE does. For example, try the experiments below. In experiments A-G, IE7 triggers no alert popups, whereas FF3 triggers many alert popups. In experiments H and I, they both fire events, but the events are different or in different numbers. "1 bCopy" = 1 onbeforecopy alert popup, etc A. Load / Reload testcase: FF3: 1x [bCut, bCopy, bPaste] IE7: Nothing B. Double-click the word "Some", to select it FF3: 3x [bCut, bCopy, bPaste] IE7: Nothing C. After performing "B", click on whitespace, to deselect "Some" FF3: 2x [bCut, bCopy, bPaste] IE7: Nothing D. Click in whitespace a little ways to the right of the period, and drag slowly back towards period so as to not actually select anything except maybe whitespace. (In FF3, this will trigger popups when you get close to the period, but before you actually see any highlighting.) FF3: 3x [bCut, bCopy, bPaste] IE7: Nothing E. [WARNING: Many popups] Click before "Some" and slowly drag across the whole line, to select all of the text. Continue dragging, even after popups start appearing, until the whole line is selected. FF3: *Many* [bCut, bCopy, bPaste]. May render Firefox unusable. IE7: Nothing F. Navigate away from testcase FF3: 3 bCut events IE7: Nothing G. With nothing selected, right-click the page. FF3: 1x [bCut, bCopy, bPaste] before context menu appears IE7: Nothing H. With the word "Some" already selected (e.g. by double-clicking it), right-click the highlighted word "Some". FF3: 1x [bCut, bCopy, bPaste] before context menu appears IE7: 2x [bCut, bCopy, bPaste]; context menu never actually appears. (bug?) I. With the word "Some" already selected (e.g. by double-clicking it), press Ctrl+c to copy the text. FF3: 1x [bPaste] IE7: 1x [bCopy]
FWIW, the previous comment's experiments were both done in Windows (via remote desktop) using these builds: FF3: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9b2pre) Gecko/2007111505 Minefield/3.0b2pre IE7: 7.0.5730.11
D'oh -- looks like the bug that added these handlers, bug 280959, has been reopened to address this very issue. Adding dependency for now. Maybe this should be marked as a dup, though.
Blocks: 280959
Component: Event Handling → DOM: Events
No longer blocks: 280959
No longer blocks: 394818
Depends on: 280959
Attached file testcase 2 (with text field) (deleted) —
Here are some additional experiments using "testcase 2", with the text field: I. Click inside text field FF3: 3x [bCut, bCopy, bPaste, bCut] IE7: Nothing J. With the cursor in the text field and some text in the clipboard, press Ctrl+v FF3: No events. Pasted text appears. IE7: 1x bPaste, and then pasted text appears.
See also bug 415921.
Bug 418457 removed support for onbeforecut/copy/paste, so this is WFM
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → WORKSFORME
(I know this is closed and "fixed" by removing the implementation - just for the record regarding these two test results: G. With nothing selected, right-click the page. FF3: 1x [bCut, bCopy, bPaste] before context menu appears IE7: Nothing H. With the word "Some" already selected (e.g. by double-clicking it), right-click the highlighted word "Some". FF3: 1x [bCut, bCopy, bPaste] before context menu appears IE7: 2x [bCut, bCopy, bPaste]; context menu never actually appears. (bug?) Firefox's behaviour for both is what I'd expect and how I want before* events to work.)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: