clipboardData is null inside clipboardEvent, when the event is created using ClipboardEvent constructor
Reported by
sandip.g...@gmail.com,
Jan 10 2018
|
|||||||
Issue description
UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36
Steps to reproduce the problem:
1. //Run the javascript code below
2. var pasteEvent = new ClipboardEvent('paste');
3. console.log(pasteEvent.clipboardData);
What is the expected behavior?
The clipboardData attribute of the ClipboardEvent object should be an instance of the DataTransfer interface, as mentioned in w3c documentation --> https://w3c.github.io/clipboard-apis/#widl-ClipboardEvent-clipboardData
What went wrong?
clipboardData is null, when the event is created using ClipboardEvent constructor (i.e. new ClipboardEvent('paste'))
Did this work before? N/A
Chrome version: 63.0.3239.132 Channel: stable
OS Version: 10.0
Flash Version:
,
Jan 11 2018
,
Jan 11 2018
Able to reproduce the issue on reported chrome version 63.0.3239.132 and on the latest canary 65.0.3315.0 using windows 10. For further investigation of the issue we have checked the same on M50(50.0.2661.0) but we are seeing a different console error output, which is neither "an instance of the DataTransfer interface" . Attaching the screen shots of both behaviours. @Reporter: Could you please have a look at the provided screen shots and let us know the good behavior. It would be highly helpful if provided with a screenshot of expected behavior, which helps us to triage the issue further in a better way. Thanks!
,
Jan 11 2018
Reagrding the error screenshot regarding version 50.0.2661.0: Creation of ClipboardEvent using the constructor (i.e. new ClipboardEvent('paste')) might not have been supported in version 50.0.2661.0. Therefore, it might not be termed as a bug in that version.
But in version 65.0.3315.0, it is supported. Therefore, a DataTransfer instance should have been available through clipboardData attribute. It is presently available in Firefox, version 57.0.4. Therefore, accepting their implementation as the expected behavior, attaching the screenshot
,
Jan 11 2018
Thank you for providing more feedback. Adding requester "vamshi.kommuri@techmahindra.com" to the cc list and removing "Needs-Feedback" label. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Jan 12 2018
Able to reproduce the issue on reported chrome version 63.0.3239.132 and on the latest canary 65.0.3315.0 using windows 10, Ubuntu 14.04 and Mac 10.13.1. Till M58 "Illegal Constructor" error is seen in while pasting in devtools. But from M-59 we are seeing "null". Hence considering this issue as Non-Regression and marking as Untriaged.
,
Jan 19 2018
"The clipboardData attribute of the ClipboardEvent object should be an instance of the DataTransfer interface, as mentioned in w3c documentation" The IDL type is: readonly attribute DataTransfer? clipboardData; Where the '?' sigil indicates 'nullable', so null is a perfectly valid value. The prose says "The clipboardData attribute is an instance of the DataTransfer interface..." which contradicts the IDL. The spec doesn't actually say how the clipboardData on the event gets populated when synthetic clipboard events are constructed. The code example in the spec does assume that clipboardData is populated, though. I'm guessing the spec needs "If eventInitDict is not given, or eventInitDict's clipboardData dictionary member is null, then initialize clipboardData to a newly created DataTransfer object." In that case, how can clipboardData be null? I'll file a spec bug.
,
Jan 19 2018
Filed https://github.com/w3c/clipboard-apis/issues/64 We can align with Firefox easily enough, but let's confirm the desired behavior.
,
Dec 13
Just to document for anyone else who comes across this issue while trying to use TypeScript with Chromium: It's currently impossible to create a ClipboardEvent and then add data to it when using TypeScript + Chromium due to a combination of this issue and the fact that TypeScript currently does not follow the W3C spec for the ClipboardEventInit interface. I have filed an issue and PR with the TypeScript project to update the interface: https://github.com/Microsoft/TypeScript/issues/28998 |
|||||||
►
Sign in to add a comment |
|||||||
Comment 1 by krajshree@chromium.org
, Jan 10 2018