Standardize or remove |beforecopy| |beforecut| and |beforepaste| events |
|||||||
Issue descriptionDocument#onbeforecopy/onbeforecut/onbeforepaste before* events are removed from the spec. Should we update the spec or remove those event handlers in Blink? Please also take a look at Element#onbeforecopy/onbeforecut/onbeforepaste/oncopy/oncut/onpaste
,
Feb 8 2017
,
Feb 9 2017
Please also take a look at: Element: onbeforecopy, onbeforecut, onbeforepaste oncopy, oncut, oonpaste
,
Feb 9 2017
,
Feb 9 2017
I remember that those are pretty useful. I would not be surprised if they are not so uncommonly used. Add use counters?
,
Feb 10 2017
Luna, would you be willing to help out with this issue (counters, deprecating, etc), or is it entirely on our plate?
,
Feb 10 2017
#5: Do you mind sharing why you think the events are useful?
,
Feb 10 2017
They are useful to "prepare the surface" prior to those actions. I do not remember at the moment the exact scenario where I found those useful (perhaps it was a drag and drop tree where I also give the option to paste and prepared the tree before the actual pasting).
,
Feb 10 2017
We're not going to yank these events without counters... but without a solid concrete use case, I think it's fair to say their days (years?) are numbered.
,
Feb 10 2017
pwnall@, Luna and I are filing bugs for all non-standard IDL features in the hope that some will be taken care of by the feature teams before we look through what's left. I would start by checking support in other browsers, it could be a lost cause where standardizing is the only way.
,
Feb 10 2017
#10: My question in #6 was meant to determine if I can get away without doing the work by passing it to someone else :D Safari appears to support the events (they appear on Element.prototype). I don't know if the bugginess concerns apply. Firefox appears to have removed support for the events -- https://bugzilla.mozilla.org/show_bug.cgi?id=418457 Edge fires the event, based on the console output of the example in http://dexteryy.github.io/cardkit-demo-gallery/oldstyle/browsers.html Would it make sense to attempt to add use counters and deprecate/remove? Web applications can't reliably depend on these events, because of lack of Firefox support. Also, we don't seem to have any WPT test, and our LayoutTests coverage seems pretty low.
,
Feb 16 2017
Yeah, use counters that measure how often the events are fired *and* there's a listener would make sense. Although, it is still possible that removing them would be harmless. A more expedient way would be to query httparchive for usage and look into how it's typically used. That could quickly reveal that removal is either hopeless or trivial.
,
Mar 9 2017
,
Dec 13 2017
I found this bug via https://chromium-review.googlesource.com/c/chromium/src/+/810806 when I asked about deprecating these. Looks like the removal would be a fairly small C++ change in Editor.cpp. #8. The "copy"-event is sent out before the copy takes place (see Editor.cpp) so can't you use 'copy' instead of 'beforecopy' to prepare or prevent the clipboard operation? To me it seems like 'beforecopy' doesn't add any extra functionality. I queried the httparchive with: select url, count(url) cnt from `httparchive.har.2017_11_15_chrome_requests_bodies` where REGEXP_CONTAINS(body, '("|\')beforecopy("|\')') # elem.addEventListener(... and elem.on(... or REGEXP_CONTAINS(body, 'onbeforecopy=("|\')') # onbeforecopy=... or REGEXP_CONTAINS(body, '("|\')beforepaste("|\')') or REGEXP_CONTAINS(body, 'onbeforepaste=("|\')') or REGEXP_CONTAINS(body, '("|\')beforecut("|\')') or REGEXP_CONTAINS(body, 'onbeforecut=("|\')') group by url order by cnt desc (2347 unique URLs) The most popular includes seem to be: 1. Youtube's base.js. 2. ckeditor.js - biggest user of 'beforepaste' and 'beforecut'. 3. https://github.com/angular/zone.js/blob/master/dist/zone.js 4. https://github.com/zeroclipboard/zeroclipboard/blob/master/dist/ZeroClipboard.js They are often included minified, usually bundled with other JS sources. For example, zone.js is hidden inside http://client.seedtag.com/st_3.093f3b769f9c46814aee.js . 1. I don't have the unscrambled version of base.js but I doubt it really depends on 'beforecopy'. 2. Seems to be a stable text editor so I guess it works on Firefox. 3. Doesn't need to be fixed? Zone.js listens for the events because it needs to intercept _all_ DOM events. 4. According to https://github.com/zeroclipboard/zeroclipboard/blob/master/docs/instructions.md#browser-specific-known-issues it runs without issues on Firefox.
,
Dec 13 2017
While Editor.cpp sends EventTypeNames::beforecut and EventTypeNames::beforecopy, I can't see 'beforepaste' being sent anywhere. With JavaScript I can confirm that it's missing. Another argument for removing 'beforecut' and 'beforecopy' is that it would allow us to remove Editor::CanDHTMLCopy() and Editor::CanDHTMLCut(). That simplifies the editing logic a little bit.
,
Aug 10
|
|||||||
►
Sign in to add a comment |
|||||||
Comment 1 by tkent@chromium.org
, Feb 8 2017Labels: Hotlist-Interop