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

Unified Diff: tools/dom/templates/html/impl/impl_Document.darttemplate

Issue 12715003: Cleaning up document.query (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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 | « tools/dom/scripts/htmlrenamer.py ('k') | tools/dom/templates/html/impl/impl_Element.darttemplate » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/templates/html/impl/impl_Document.darttemplate
diff --git a/tools/dom/templates/html/impl/impl_Document.darttemplate b/tools/dom/templates/html/impl/impl_Document.darttemplate
index c1714b09cd946dee44a5107d48787f4d9e9a1713..73b40fa1f133ad18d2ee6c55195b4bc29c7c371c 100644
--- a/tools/dom/templates/html/impl/impl_Document.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Document.darttemplate
@@ -19,30 +19,6 @@ $(ANNOTATIONS)class $CLASSNAME extends Node $NATIVESPEC
$!MEMBERS
/**
- * 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.
- if (new RegExp("^#[_a-zA-Z]\\w*\$").hasMatch(selectors)) {
- return $dom_getElementById(selectors.substring(1));
- }
- return $dom_querySelector(selectors);
- }
-
- /**
* Finds all descendant elements of this document that match the specified
* group of selectors.
*
@@ -57,25 +33,6 @@ $!MEMBERS
* [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(
- selectors.substring(7,selectors.length - 2));
- int len = mutableMatches.length;
- final copyOfMatches = new List<Element>(len);
- for (int i = 0; i < len; ++i) {
- copyOfMatches[i] = mutableMatches[i];
- }
- return new _FrozenElementList._wrap(copyOfMatches);
- } else if (new RegExp("^[*a-zA-Z0-9]+\$").hasMatch(selectors)) {
- final mutableMatches = $dom_getElementsByTagName(selectors);
- int len = mutableMatches.length;
- final copyOfMatches = new List<Element>(len);
- for (int i = 0; i < len; ++i) {
- copyOfMatches[i] = mutableMatches[i];
- }
- return new _FrozenElementList._wrap(copyOfMatches);
- } else {
- return new _FrozenElementList._wrap($dom_querySelectorAll(selectors));
- }
+ return new _FrozenElementList._wrap($dom_querySelectorAll(selectors));
}
}
« no previous file with comments | « tools/dom/scripts/htmlrenamer.py ('k') | tools/dom/templates/html/impl/impl_Element.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698