Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1753)

Unified Diff: dart/site/try/src/interaction_manager.dart

Issue 535883002: Use JavaScript to detect if Selection.modify is available. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merged with r39804 Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dart/site/try/index.html ('k') | dart/site/try/src/messages.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/site/try/src/interaction_manager.dart
diff --git a/dart/site/try/src/interaction_manager.dart b/dart/site/try/src/interaction_manager.dart
index 7d704e8e0cdd5592617ef3ed2be3f05b98f449e1..3776dc23014dc3cf52fde88b4c2757f84d77b426 100644
--- a/dart/site/try/src/interaction_manager.dart
+++ b/dart/site/try/src/interaction_manager.dart
@@ -21,8 +21,6 @@ import 'dart:async' show
import 'dart:collection' show
Queue;
-import 'dart:js' as hack;
-
import 'package:compiler/implementation/scanner/scannerlib.dart' show
BeginGroupToken,
EOF_TOKEN,
@@ -1303,17 +1301,14 @@ void workAroundFirefoxBug() {
if (!isCollapsed(selection)) return;
Node node = selection.anchorNode;
int offset = selection.anchorOffset;
- if (selection.anchorNode is Element && selection.anchorOffset != 0) {
+ if (node is Element && offset != 0) {
// In some cases, Firefox reports the wrong anchorOffset (always seems to
// be 6) when anchorNode is an Element. Moving the cursor back and forth
// adjusts the anchorOffset.
// Safari can also reach this code, but the offset isn't wrong, just
// inconsistent. After moving the cursor back and forth, Safari will make
// the offset relative to a text node.
- // TODO(ahe): Come up with a better way to encapsulate the method below.
- var selectionProxy = new hack.JsObject.fromBrowserObject(selection);
- var modify = selectionProxy['modify'];
- if (modify != null) {
+ if (settings.hasSelectionModify.value) {
// IE doesn't support selection.modify, but it's okay since the code
// above is for Firefox, IE doesn't have problems with anchorOffset.
selection
« no previous file with comments | « dart/site/try/index.html ('k') | dart/site/try/src/messages.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698