Closed
Bug 390238
Opened 17 years ago
Closed 17 years ago
Onbeforecut, onbeforecopy and onbeforepaste events fire when focusing text control
Categories
(Core :: DOM: Events, defect)
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: martijn.martijn, Unassigned)
References
Details
(Keywords: testcase)
Attachments
(2 files, 1 obsolete file)
See testcase. It seems like the onbeforecut, onbeforecopy and onbeforepaste events fire when the text controls get focused (onbeforecut even gets fired 2 times, it seems). That's not what IE7 is doing, so I guess it's also not something Mozilla should be doing. Another bug, I think: IE7 fires onbeforecut, onbeforecopy and onbeforepaste (onbeforecut only when something is selected) when the 'Edit' menu is opened. That's not what Mozilla is doing at the moment.
Reporter | ||
Comment 1•17 years ago
|
||
Attachment #274559 -
Attachment is obsolete: true
Comment 2•17 years ago
|
||
I think it's better to fire the events when the selection changes rather than when menus are opened. Doing it when the selection changes lets Mozilla update Cut/Copy/Paste toolbar buttons in addition to menu items.
Comment 3•17 years ago
|
||
This behavior is expected and intentional. As Mozilla updates the "enabledness" of the cut/copy/paste commands when selection changes, the before___ events fire to permit override of the standard behavior. IE fires before___ events when the context or main menu is opened, even if the selection has not changed, to check whether the commands are enabled. Safari fires the events only when the context menu is opened (iirc). Based upon the purpose of the events, and that it is possible to create a single event handler that works in all major browsers to serve the purposes of these events (no code incompatibilities), it's my belief that the different event firing situations is an unimportant browser implementation detail. Counter-arguments? Incompatibilities that I haven't thought of? I'm interested in hearing ideas.
Reporter | ||
Comment 4•17 years ago
|
||
Well, I just don't see a good reason to be incompatible with IE here.
Reporter | ||
Comment 5•17 years ago
|
||
This is causing a hang in current trunk build, because of beforepaste firing when the text control gets focused.
Reporter | ||
Comment 6•17 years ago
|
||
I guess someone should mark this bug WONTFIX then (which I don't agree with, fwiw). Then I´ll file a new bug for the hanging issue.
Comment 7•17 years ago
|
||
Martijn, there is no good reason to be incompatible with IE in this case. But there is a practical reason; I think it would be a big patch to fix a pretty small problem. I'm not sure if any command handlers are updated when menus are opened, or if they're all calculated on events (such as selection) like the clipboard handlers. I like your hang testcase. Please assign the new bug to me. Because it loops via .focus(), it never hits the "A script on this page is making it run slowly" error. Would the same hang happen if it was onfocus, rather than onbeforepaste?
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → WONTFIX
Reporter | ||
Comment 8•17 years ago
|
||
(In reply to comment #7) Ok, I filed 391399 now, and I tried to answer your questions in that bug.
You need to log in
before you can comment on or make changes to this bug.
Description
•