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

Unified Diff: charted/lib/selection/selection_scope.dart

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 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 | « charted/lib/selection/selection.dart ('k') | charted/lib/selection/src/selection_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: charted/lib/selection/selection_scope.dart
diff --git a/charted/lib/selection/selection_scope.dart b/charted/lib/selection/selection_scope.dart
deleted file mode 100644
index 3543f92cf021ccb0fd25f27ebe0878d35c30c7db..0000000000000000000000000000000000000000
--- a/charted/lib/selection/selection_scope.dart
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright 2014 Google Inc. All rights reserved.
- *
- * Use of this source code is governed by a BSD-style
- * license that can be found in the LICENSE file or at
- * https://developers.google.com/open-source/licenses/bsd
- */
-
-part of charted.selection;
-
-/** SelectionScope represents a scope for all the data and DOM operations. */
-class SelectionScope {
- Expando _associations = new Expando();
- Expando<Map<String, Pair<Function, bool>>> _listeners = new Expando();
- Element _root;
-
- /** Creates a new selection scope with document as the root. */
- SelectionScope() {
- _root = document.documentElement;
- }
-
- /**
- * Creates a new selection scope with the first element matching
- * [selector] as the root.
- */
- SelectionScope.selector(String selector) {
- if (selector == null || selector.isEmpty ){
- throw new ArgumentError('Selector cannot be empty');
- }
- _root = document.querySelector(selector);
- }
-
- /**
- * Creates a new selection scope with the passed [element] as [root].
- * Charted assumes that the element is already part of the DOM.
- */
- SelectionScope.element(Element element) {
- if (element == null) {
- throw new ArgumentError('Root element for SelectionScope cannot be null');
- }
- _root = element;
- }
-
- /**
- * Returns the [root] element for this scope.
- * All [Selection]s and elements created using the Charted API,
- * are created as descendants of root.
- */
- Element get root => _root;
-
- /*
- * Current event for which a callback is being called.
- */
- Event event;
-
- /** Returns the stored for the given [element]. */
- datum(Object element) => element == null ? null : _associations[element];
-
- /** Associates data to the given [element]. */
- associate(Object element, datum) =>
- datum != null ? _associations[element] = datum : null;
-
- /**
- * Creates a new [Selection] containing the first element matching
- * [selector]. If no element matches, the resulting selection will
- * have a null element.
- */
- Selection select(String selector) =>
- new _SelectionImpl.single(selector: selector, scope: this);
-
- /**
- * Creates a new [Selection] containing all elements matching [selector].
- * If no element matches, the resulting selection will not have any
- * elements in it.
- */
- Selection selectAll(String selector) =>
- new _SelectionImpl.all(selector:selector, scope:this);
-
- /**
- * Creates a new [Selection] containing [elements]. Assumes that
- * all the given elements are descendants of [root] in DOM.
- */
- Selection selectElements(List<Element> elements) =>
- new _SelectionImpl.elements(elements, this);
-
- /**
- * Appends a new element to [root] and creates a selection containing
- * the newly added element.
- */
- Selection append(String tag) {
- var element = Namespace.createChildElement(tag, _root);
- root.children.add(element);
-
- return selectElements([element]);
- }
-}
« no previous file with comments | « charted/lib/selection/selection.dart ('k') | charted/lib/selection/src/selection_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698