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

Unified Diff: sdk/lib/html/dartium/html_dartium.dart

Issue 11316258: Document the document class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: more fixes Created 8 years, 1 month 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 | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | sdk/lib/html/docs/html_docs.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/dartium/html_dartium.dart
diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart
index 47de7ec22a128acd10e208061117ad4cd995962b..87d87a585128c33d115ffe882c789e4e57d7dd41 100644
--- a/sdk/lib/html/dartium/html_dartium.dart
+++ b/sdk/lib/html/dartium/html_dartium.dart
@@ -7656,6 +7656,15 @@ class DivElement extends _Element_Merged {
/// @domName Document
+/**
+ * The base class for all documents.
+ *
+ * Each web page loaded in the browser has its own [Document] object, which is
+ * typically an [HtmlDocument].
+ *
+ * If you aren't comfortable with DOM concepts, see the Dart tutorial
+ * [Target 2: Connect Dart & HTML](http://www.dartlang.org/docs/tutorials/connect-dart-html/).
+ */
class Document extends Node
{
@@ -7877,8 +7886,22 @@ class Document extends Node
/** @domName Document.webkitExitPointerLock */
void $dom_webkitExitPointerLock() native "Document_webkitExitPointerLock_Callback";
- // TODO(jacobr): implement all Element methods not on Document.
+ /**
+ * Finds the first descendant element of this document that matches the
+ * specified group of selectors.
+ *
+ * Unless your webpage contains multiple documents, the top-level query
+ * method behaves the same as this method, so you should use it instead to
+ * save typing a few characters.
+ *
+ * [selectors] should be a string using CSS selector syntax.
+ * var element1 = document.query('.className');
+ * var element2 = document.query('#id');
+ *
+ * For details about CSS selector syntax, see the
+ * [CSS selector specification](http://www.w3.org/TR/css3-selectors/).
+ */
Element query(String selectors) {
// It is fine for our RegExp to detect element id query selectors to have
// false negatives but not false positives.
@@ -7888,6 +7911,20 @@ class Document extends Node
return $dom_querySelector(selectors);
}
+ /**
+ * Finds all descendant elements of this document that match the specified
+ * group of selectors.
+ *
+ * Unless your webpage contains multiple documents, the top-level queryAll
+ * method behaves the same as this method, so you should use it instead to
+ * save typing a few characters.
+ *
+ * [selectors] should be a string using CSS selector syntax.
+ * var items = document.queryAll('.itemClassName');
+ *
+ * For details about CSS selector syntax, see the
+ * [CSS selector specification](http://www.w3.org/TR/css3-selectors/).
+ */
List<Element> queryAll(String selectors) {
if (new RegExp("""^\\[name=["'][^'"]+['"]\\]\$""").hasMatch(selectors)) {
final mutableMatches = $dom_getElementsByName(
@@ -9709,6 +9746,19 @@ class EventSourceEvents extends Events {
// BSD-style license that can be found in the LICENSE file.
+/**
+ * Base class that supports listening for and dispatching browser events.
+ *
+ * Events can either be accessed by string name (using the indexed getter) or by
+ * getters exposed by subclasses. Use the getters exposed by subclasses when
+ * possible for better compile-time type checks.
+ *
+ * Using an indexed getter:
+ * events['mouseover'].add((e) => print("Mouse over!"));
+ *
+ * Using a getter provided by a subclass:
+ * elementEvents.mouseOver.add((e) => print("Mouse over!"));
+ */
class Events {
/* Raw event target. */
final EventTarget _ptr;
@@ -9720,6 +9770,9 @@ class Events {
}
}
+/**
+ * Supports adding, removing, and dispatching events for a specific event type.
+ */
class EventListenerList {
final EventTarget _ptr;
@@ -9755,6 +9808,14 @@ class EventListenerList {
}
/// @domName EventTarget
+/**
+ * Base class for all browser objects that support events.
+ *
+ * Use the [on] property to add, remove, and dispatch events (rather than
+ * [$dom_addEventListener], [$dom_dispatchEvent], and
+ * [$dom_removeEventListener]) for compile-time type checks and a more concise
+ * API.
+ */
class EventTarget extends NativeFieldWrapperClass1 {
/** @domName EventTarget.addEventListener, EventTarget.removeEventListener, EventTarget.dispatchEvent */
« no previous file with comments | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | sdk/lib/html/docs/html_docs.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698