Dart2JS breaks the HTML5 Selection.toString() method #27789
Labels
area-web
Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop.
library-html
type-bug
Incorrect behavior (everything from a crash to more subtle misbehavior)
web-libraries
Issues impacting dart:html, etc., libraries
In both Dart and Javascript, you can get the selected/highlighted text in the browser by calling
window.getSelection().toString()
. However, Dart2JS breaks this. Instead of the selected text, it gives the literal stringInstance of 'Selection'
.Example Dart code (works in Dartium):
The compiled Javascript for this says something like:
After manually changing the last line to
it works correctly.
The text was updated successfully, but these errors were encountered: