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

Unified Diff: sdk/lib/html/templates/html/impl/impl_Document.darttemplate

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/docs/html_docs.json ('k') | sdk/lib/html/templates/html/impl/impl_EventTarget.darttemplate » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/templates/html/impl/impl_Document.darttemplate
diff --git a/sdk/lib/html/templates/html/impl/impl_Document.darttemplate b/sdk/lib/html/templates/html/impl/impl_Document.darttemplate
index 0ddb96545a01bfdd604e66aba7f4316746f8d429..3971f831a21c4ebb5f8e019a9cd0e616381450e6 100644
--- a/sdk/lib/html/templates/html/impl/impl_Document.darttemplate
+++ b/sdk/lib/html/templates/html/impl/impl_Document.darttemplate
@@ -5,12 +5,35 @@
part of html;
/// @domName $DOMNAME
+/**
+ * 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 $CLASSNAME extends Node $NATIVESPEC
{
$!MEMBERS
- // 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.
@@ -20,6 +43,20 @@ $!MEMBERS
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(
« no previous file with comments | « sdk/lib/html/docs/html_docs.json ('k') | sdk/lib/html/templates/html/impl/impl_EventTarget.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698