bc75856e54
expose ServiceWorker, removed query and queryAll from in dart:html, added constructor to MessageChannel and removed getCssCanvasContext. Fixed all tests using query and queryAll. Fixes https://github.com/dart-lang/sdk/issues/25664 Fixes https://github.com/dart-lang/sdk/issues/26349 Fixes https://github.com/dart-lang/sdk/issues/32323 Fixes https://github.com/dart-lang/sdk/issues/32659 Fixes https://github.com/dart-lang/sdk/issues/32675 R=kevmoo@google.com Change-Id: I687471e80b8fe9c7040673113f424dbaab7c64d4 Reviewed-on: https://dart-review.googlesource.com/48381 Commit-Queue: Terry Lucas <terry@google.com> Reviewed-by: Kevin Moore <kevmoo@google.com>
100 lines
2.9 KiB
Plaintext
100 lines
2.9 KiB
Plaintext
// Copyright (c) 2011, 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;
|
|
|
|
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
|
|
factory $CLASSNAME() => document.createDocumentFragment();
|
|
|
|
factory $CLASSNAME.html(String html,
|
|
{NodeValidator validator, NodeTreeSanitizer treeSanitizer}) {
|
|
|
|
return document.body.createFragment(html,
|
|
validator: validator, treeSanitizer: treeSanitizer);
|
|
}
|
|
|
|
factory $CLASSNAME.svg(String svgContent,
|
|
{NodeValidator validator, NodeTreeSanitizer treeSanitizer}) {
|
|
|
|
return new svg.SvgSvgElement().createFragment(svgContent,
|
|
validator: validator, treeSanitizer: treeSanitizer);
|
|
}
|
|
|
|
HtmlCollection get _children => throw new UnimplementedError(
|
|
'Use _docChildren instead');
|
|
|
|
// Native field is used only by Dart code so does not lead to instantiation
|
|
// of native classes
|
|
@Creates('Null')
|
|
List<Element> _docChildren;
|
|
|
|
List<Element> get children {
|
|
if (_docChildren == null) {
|
|
_docChildren = new FilteredElementList(this);
|
|
}
|
|
return _docChildren;
|
|
}
|
|
|
|
set children(List<Element> value) {
|
|
// Copy list first since we don't want liveness during iteration.
|
|
var copy = value.toList();
|
|
var children = this.children;
|
|
children.clear();
|
|
children.addAll(copy);
|
|
}
|
|
|
|
/**
|
|
* Finds all descendant elements of this document fragment that match the
|
|
* specified group of selectors.
|
|
*
|
|
* [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));
|
|
|
|
|
|
String get innerHtml {
|
|
final e = new DivElement();
|
|
e.append(this.clone(true));
|
|
return e.innerHtml;
|
|
}
|
|
|
|
set innerHtml(String value) {
|
|
this.setInnerHtml(value);
|
|
}
|
|
|
|
void setInnerHtml(String html,
|
|
{NodeValidator validator, NodeTreeSanitizer treeSanitizer}) {
|
|
|
|
this.nodes.clear();
|
|
append(document.body.createFragment(
|
|
html, validator: validator, treeSanitizer: treeSanitizer));
|
|
}
|
|
|
|
/**
|
|
* Adds the specified text as a text node after the last child of this
|
|
* document fragment.
|
|
*/
|
|
void appendText(String text) {
|
|
this.append(new Text(text));
|
|
}
|
|
|
|
|
|
/**
|
|
* Parses the specified text as HTML and adds the resulting node after the
|
|
* last child of this document fragment.
|
|
*/
|
|
void appendHtml(String text, {NodeValidator validator,
|
|
NodeTreeSanitizer, treeSanitizer}) {
|
|
this.append(new DocumentFragment.html(text, validator: validator,
|
|
treeSanitizer: treeSanitizer));
|
|
}
|
|
$!MEMBERS
|
|
}
|