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

Side by Side Diff: tools/dom/templates/html/impl/impl_Document.darttemplate

Issue 27223003: Deprecate query and queryAll, also add back querySelector and querySelectorAll. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of $LIBRARYNAME; 5 part of $LIBRARYNAME;
6 6
7 @DocsEditable 7 @DocsEditable
8 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME extends Node $NATIVESPEC 8 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME extends Node $NATIVESPEC
9 { 9 {
10 10
11 $!MEMBERS 11 $!MEMBERS
12 /** 12 /**
13 * Finds all descendant elements of this document that match the specified 13 * Finds all descendant elements of this document that match the specified
14 * group of selectors. 14 * group of selectors.
15 * 15 *
16 * Unless your webpage contains multiple documents, the top-level queryAll 16 * Unless your webpage contains multiple documents, the top-level
17 * [querySelectorAll]
17 * method behaves the same as this method, so you should use it instead to 18 * method behaves the same as this method, so you should use it instead to
18 * save typing a few characters. 19 * save typing a few characters.
19 * 20 *
20 * [selectors] should be a string using CSS selector syntax. 21 * [selectors] should be a string using CSS selector syntax.
21 * var items = document.queryAll('.itemClassName'); 22 * var items = document.querySelectorAll('.itemClassName');
22 * 23 *
23 * For details about CSS selector syntax, see the 24 * For details about CSS selector syntax, see the
24 * [CSS selector specification](http://www.w3.org/TR/css3-selectors/). 25 * [CSS selector specification](http://www.w3.org/TR/css3-selectors/).
25 */ 26 */
26 ElementList queryAll(String selectors) { 27 ElementList querySelectorAll(String selectors) {
27 return new _FrozenElementList._wrap(_querySelectorAll(selectors)); 28 return new _FrozenElementList._wrap(_querySelectorAll(selectors));
28 } 29 }
29 30
31 /**
32 * Alias for [querySelector]. Note this function is deprecated because its
33 * semantics will be changing in the future.
34 */
35 @deprecated
36 @Experimental()
37 @DomName('Document.querySelector')
38 Element query(String relativeSelectors) => querySelector(relativeSelectors);
39
40 /**
41 * Alias for [querySelectorAll]. Note this function is deprecated because its
42 * semantics will be changing in the future.
43 */
44 @deprecated
45 @Experimental()
46 @DomName('Document.querySelectorAll')
47 ElementList queryAll(String relativeSelectors) =>
48 querySelectorAll(relativeSelectors);
49
30 /// Checks if [register] is supported on the current platform. 50 /// Checks if [register] is supported on the current platform.
31 bool get supportsRegister { 51 bool get supportsRegister {
32 $if DART2JS 52 $if DART2JS
33 return JS('bool', '("register" in #)', this); 53 return JS('bool', '("register" in #)', this);
34 $else 54 $else
35 return true; 55 return true;
36 $endif 56 $endif
37 } 57 }
38 58
39 @DomName('Document.createElement') 59 @DomName('Document.createElement')
40 Element createElement(String tagName, [String typeExtension]) { 60 Element createElement(String tagName, [String typeExtension]) {
41 $if DART2JS 61 $if DART2JS
42 return _createElement(tagName, typeExtension); 62 return _createElement(tagName, typeExtension);
43 $else 63 $else
44 if (typeExtension != null) { 64 if (typeExtension != null) {
45 return _createElement(tagName, typeExtension); 65 return _createElement(tagName, typeExtension);
46 } else { 66 } else {
47 // Fast-path for Dartium when typeExtension is not needed. 67 // Fast-path for Dartium when typeExtension is not needed.
48 return _Utils.createElement(this, tagName); 68 return _Utils.createElement(this, tagName);
49 } 69 }
50 $endif 70 $endif
51 } 71 }
52 } 72 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698