Sdk: Paste event e.clipboardData.types not working with Firefox

Created on 19 Oct 2016  路  2Comments  路  Source: dart-lang/sdk

This code fails with Firefox (e is a paste event):
h.DataTransfer data = e.clipboardData; if (data.types.contains('text/html')) { ... }
Error: TypeError: t1.contains$1 is not a function
This looks like a bug in dart2js (getInterceptor does not recognize DOMStringList).

Using Firefox 49.0 and Dart 1.20.1.

P2 area-web type-bug web-dart2js

Most helpful comment

I just ran into the same thing, I'm not seeing a way to even work around it when we know we're running in Firefox either. data.types prints to the console as [Object DOMStringList] which is the JS type, can't be cast to the Dart DomStringList type.

All 2 comments

I just ran into the same thing, I'm not seeing a way to even work around it when we know we're running in Firefox either. data.types prints to the console as [Object DOMStringList] which is the JS type, can't be cast to the Dart DomStringList type.

fwiw, you can still query for specific known formats so if you know you're interested in plain text or HTML, that is still doable

Was this page helpful?
0 / 5 - 0 ratings