blob: a745435d302c17eba9e859d45cb73bd016f46a4a [file] [log] [blame]
// 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)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME extends Node
{
$!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<T> querySelectorAll<T extends Element>(String selectors) =>
new _FrozenElementList<T>._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<T> queryAll<T extends Element>(String relativeSelectors) =>
querySelectorAll(relativeSelectors);
/// Checks if [registerElement] is supported on the current platform.
bool get supportsRegisterElement {
return JS('bool', '("registerElement" in #)', this);
}
/// *Deprecated*: use [supportsRegisterElement] instead.
@deprecated
bool get supportsRegister => supportsRegisterElement;
@DomName('Document.createElement')
Element createElement(String tagName, [String typeExtension]) {
return (typeExtension == null)
? _createElement_2(tagName)
: _createElement(tagName, typeExtension);
}
// The two-argument version of this is automatically generated, but we need to
// omit the typeExtension if it's null on Firefox or we get an is="null" attribute.
@DomName('Document.createElement')
_createElement_2(String tagName) =>
JS('Element', '#.createElement(#)', this, tagName);
// The three-argument version of this is automatically generated, but we need to
// omit the typeExtension if it's null on Firefox or we get an is="null" attribute.
@DomName('Document.createElementNS')
_createElementNS_2(String namespaceURI, String qualifiedName) =>
JS('Element', '#.createElementNS(#, #)', this, namespaceURI, qualifiedName);
@DomName('Document.createElementNS')
@DocsEditable()
Element createElementNS(String namespaceURI, String qualifiedName, [String typeExtension]) {
return (typeExtension == null)
? _createElementNS_2(namespaceURI, qualifiedName)
: _createElementNS(namespaceURI, qualifiedName, typeExtension);
}
@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);
@DomName('Document.visibilityState')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.FIREFOX)
@SupportedBrowser(SupportedBrowser.IE, '10')
@Experimental()
String get visibilityState => JS('String',
'(#.visibilityState || #.mozVisibilityState || #.msVisibilityState ||'
'#.webkitVisibilityState)', this, this, this, this);
}