OLD | NEW |
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)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME extends Node | 8 $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME extends Node |
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 | 16 * Unless your webpage contains multiple documents, the top-level |
17 * [querySelectorAll] | 17 * [querySelectorAll] |
18 * 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 |
19 * save typing a few characters. | 19 * save typing a few characters. |
20 * | 20 * |
21 * [selectors] should be a string using CSS selector syntax. | 21 * [selectors] should be a string using CSS selector syntax. |
22 * | 22 * |
23 * var items = document.querySelectorAll('.itemClassName'); | 23 * var items = document.querySelectorAll('.itemClassName'); |
24 * | 24 * |
25 * For details about CSS selector syntax, see the | 25 * For details about CSS selector syntax, see the |
26 * [CSS selector specification](http://www.w3.org/TR/css3-selectors/). | 26 * [CSS selector specification](http://www.w3.org/TR/css3-selectors/). |
27 */ | 27 */ |
28 ElementList<Element> querySelectorAll(String selectors) { | 28 ElementList<Element> querySelectorAll(String selectors) { |
| 29 $if JSINTEROP |
| 30 return _querySelectorAll(selectors); |
| 31 $else |
29 return new _FrozenElementList._wrap(_querySelectorAll(selectors)); | 32 return new _FrozenElementList._wrap(_querySelectorAll(selectors)); |
| 33 $endif |
30 } | 34 } |
31 | 35 |
32 /** | 36 /** |
33 * Alias for [querySelector]. Note this function is deprecated because its | 37 * Alias for [querySelector]. Note this function is deprecated because its |
34 * semantics will be changing in the future. | 38 * semantics will be changing in the future. |
35 */ | 39 */ |
36 @deprecated | 40 @deprecated |
37 @Experimental() | 41 @Experimental() |
38 @DomName('Document.querySelector') | 42 @DomName('Document.querySelector') |
39 Element query(String relativeSelectors) => querySelector(relativeSelectors); | 43 Element query(String relativeSelectors) => querySelector(relativeSelectors); |
(...skipping 19 matching lines...) Expand all Loading... |
59 | 63 |
60 /// *Deprecated*: use [supportsRegisterElement] instead. | 64 /// *Deprecated*: use [supportsRegisterElement] instead. |
61 @deprecated | 65 @deprecated |
62 bool get supportsRegister => supportsRegisterElement; | 66 bool get supportsRegister => supportsRegisterElement; |
63 | 67 |
64 @DomName('Document.createElement') | 68 @DomName('Document.createElement') |
65 Element createElement(String tagName, [String typeExtension]) { | 69 Element createElement(String tagName, [String typeExtension]) { |
66 $if DART2JS | 70 $if DART2JS |
67 return _createElement(tagName, typeExtension); | 71 return _createElement(tagName, typeExtension); |
68 $else | 72 $else |
69 if (typeExtension != null) { | 73 $if JSINTEROP |
70 return _createElement(tagName, typeExtension); | 74 return _createElement(tagName, typeExtension); |
71 } else { | 75 $else |
72 // Fast-path for Dartium when typeExtension is not needed. | 76 if (typeExtension != null) { |
73 return _Utils.createElement(this, tagName); | 77 return _createElement(tagName, typeExtension); |
74 } | 78 } else { |
| 79 // Fast-path for Dartium when typeExtension is not needed. |
| 80 return _Utils.createElement(this, tagName); |
| 81 } |
| 82 $endif |
75 $endif | 83 $endif |
76 } | 84 } |
77 | 85 |
78 $if DART2JS | 86 $if DART2JS |
79 @DomName('Document.createNodeIterator') | 87 @DomName('Document.createNodeIterator') |
80 NodeIterator _createNodeIterator(Node root, | 88 NodeIterator _createNodeIterator(Node root, |
81 [int whatToShow, NodeFilter filter]) | 89 [int whatToShow, NodeFilter filter]) |
82 => JS('NodeIterator', '#.createNodeIterator(#, #, #, false)', | 90 => JS('NodeIterator', '#.createNodeIterator(#, #, #, false)', |
83 this, root, whatToShow, filter); | 91 this, root, whatToShow, filter); |
84 | 92 |
85 @DomName('Document.createTreeWalker') | 93 @DomName('Document.createTreeWalker') |
86 TreeWalker _createTreeWalker(Node root, | 94 TreeWalker _createTreeWalker(Node root, |
87 [int whatToShow, NodeFilter filter]) | 95 [int whatToShow, NodeFilter filter]) |
88 => JS('TreeWalker', '#.createTreeWalker(#, #, #, false)', | 96 => JS('TreeWalker', '#.createTreeWalker(#, #, #, false)', |
89 this, root, whatToShow, filter); | 97 this, root, whatToShow, filter); |
90 $endif | 98 $endif |
91 } | 99 } |
OLD | NEW |