| // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| // for details. All rights reserved. Use of this source code is governed by a |
| // BSD-style license that can be found in the LICENSE file. |
| |
| part of $LIBRARYNAME; |
| |
| @DocsEditable() |
| $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME extends Node $NATIVESPEC |
| { |
| |
| $!MEMBERS |
| /** |
| * Finds all descendant elements of this document that match the specified |
| * group of selectors. |
| * |
| * Unless your webpage contains multiple documents, the top-level |
| * [querySelectorAll] |
| * 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.querySelectorAll('.itemClassName'); |
| * |
| * For details about CSS selector syntax, see the |
| * [CSS selector specification](http://www.w3.org/TR/css3-selectors/). |
| */ |
| ElementList querySelectorAll(String selectors) { |
| return new _FrozenElementList._wrap(_querySelectorAll(selectors)); |
| } |
| |
| /** |
| * Alias for [querySelector]. Note this function is deprecated because its |
| * semantics will be changing in the future. |
| */ |
| @deprecated |
| @Experimental() |
| @DomName('Document.querySelector') |
| Element query(String relativeSelectors) => querySelector(relativeSelectors); |
| |
| /** |
| * Alias for [querySelectorAll]. Note this function is deprecated because its |
| * semantics will be changing in the future. |
| */ |
| @deprecated |
| @Experimental() |
| @DomName('Document.querySelectorAll') |
| ElementList queryAll(String relativeSelectors) => |
| querySelectorAll(relativeSelectors); |
| |
| /// Checks if [registerElement] is supported on the current platform. |
| bool get supportsRegisterElement { |
| $if DART2JS |
| return JS('bool', '("registerElement" in #)', this); |
| $else |
| return true; |
| $endif |
| } |
| |
| /// *Deprecated*: use [supportsRegisterElement] instead. |
| @deprecated |
| bool get supportsRegister => supportsRegisterElement; |
| |
| @DomName('Document.createElement') |
| Element createElement(String tagName, [String typeExtension]) { |
| $if DART2JS |
| return _createElement(tagName, typeExtension); |
| $else |
| if (typeExtension != null) { |
| return _createElement(tagName, typeExtension); |
| } else { |
| // Fast-path for Dartium when typeExtension is not needed. |
| return _Utils.createElement(this, tagName); |
| } |
| $endif |
| } |
| |
| $if DART2JS |
| @DomName('Document.createNodeIterator') |
| NodeIterator _createNodeIterator(Node root, |
| [int whatToShow, NodeFilter filter]) |
| => JS('NodeIterator', '#.createNodeIterator(#, #, #, false)', |
| this, root, whatToShow, filter); |
| |
| @DomName('Document.createTreeWalker') |
| TreeWalker _createTreeWalker(Node root, |
| [int whatToShow, NodeFilter filter]) |
| => JS('TreeWalker', '#.createTreeWalker(#, #, #, false)', |
| this, root, whatToShow, filter); |
| $endif |
| } |