mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 04:16:51 +00:00
Make Node.nodes.insertAll work for an end-positioned index.
R=blois@google.com Review URL: https://codereview.chromium.org//613063002 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40819 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
parent
4543995374
commit
be78d098a0
|
@ -7993,10 +7993,10 @@ class BlinkTreeWalker {
|
|||
class BlinkURL {
|
||||
static createObjectURL_Callback_Blob(blob_OR_source_OR_stream) native "URL_createObjectURL_Callback_Blob";
|
||||
|
||||
static createObjectURL_Callback_MediaStream(blob_OR_source_OR_stream) native "URL_createObjectURL_Callback_MediaStream";
|
||||
|
||||
static createObjectURL_Callback_MediaSource(blob_OR_source_OR_stream) native "URL_createObjectURL_Callback_MediaSource";
|
||||
|
||||
static createObjectURL_Callback_MediaStream(blob_OR_source_OR_stream) native "URL_createObjectURL_Callback_MediaStream";
|
||||
|
||||
static revokeObjectURL_Callback_DOMString(url) native "URL_revokeObjectURL_Callback_DOMString";
|
||||
|
||||
static hash_Getter(mthis) native "URL_hash_Getter";
|
||||
|
|
|
@ -21572,8 +21572,12 @@ class _ChildNodeListLazy extends ListBase<Node> implements NodeListWrapper {
|
|||
}
|
||||
|
||||
void insertAll(int index, Iterable<Node> iterable) {
|
||||
var item = this[index];
|
||||
_this.insertAllBefore(iterable, item);
|
||||
if (index == length) {
|
||||
addAll(iterable);
|
||||
} else {
|
||||
var item = this[index];
|
||||
_this.insertAllBefore(iterable, item);
|
||||
}
|
||||
}
|
||||
|
||||
void setAll(int index, Iterable<Node> iterable) {
|
||||
|
|
|
@ -23487,8 +23487,12 @@ class _ChildNodeListLazy extends ListBase<Node> implements NodeListWrapper {
|
|||
}
|
||||
|
||||
void insertAll(int index, Iterable<Node> iterable) {
|
||||
var item = this[index];
|
||||
_this.insertAllBefore(iterable, item);
|
||||
if (index == length) {
|
||||
addAll(iterable);
|
||||
} else {
|
||||
var item = this[index];
|
||||
_this.insertAllBefore(iterable, item);
|
||||
}
|
||||
}
|
||||
|
||||
void setAll(int index, Iterable<Node> iterable) {
|
||||
|
@ -31073,12 +31077,12 @@ class Url extends NativeFieldWrapperClass2 implements UrlUtils {
|
|||
if ((blob_OR_source_OR_stream is Blob || blob_OR_source_OR_stream == null)) {
|
||||
return _blink.BlinkURL.createObjectURL_Callback_Blob(blob_OR_source_OR_stream);
|
||||
}
|
||||
if ((blob_OR_source_OR_stream is MediaStream)) {
|
||||
return _blink.BlinkURL.createObjectURL_Callback_MediaStream(blob_OR_source_OR_stream);
|
||||
}
|
||||
if ((blob_OR_source_OR_stream is MediaSource)) {
|
||||
return _blink.BlinkURL.createObjectURL_Callback_MediaSource(blob_OR_source_OR_stream);
|
||||
}
|
||||
if ((blob_OR_source_OR_stream is MediaStream)) {
|
||||
return _blink.BlinkURL.createObjectURL_Callback_MediaStream(blob_OR_source_OR_stream);
|
||||
}
|
||||
throw new ArgumentError("Incorrect number or type of arguments");
|
||||
}
|
||||
|
||||
|
|
|
@ -316,6 +316,13 @@ main() {
|
|||
expect(node.nodes[6], isImageElement);
|
||||
expect(node.nodes[7], isInputElement);
|
||||
expect(node.nodes[8], isComment);
|
||||
|
||||
var d = new DivElement();
|
||||
var ns = d.nodes;
|
||||
// `insertAll` should work when positioned at end.
|
||||
ns.insertAll(ns.length, [new HRElement()]);
|
||||
expect(ns.length, 1);
|
||||
expect(ns[0], isHRElement);
|
||||
});
|
||||
|
||||
testUnsupported('removeRange', () {
|
||||
|
|
|
@ -83,8 +83,12 @@ $endif
|
|||
}
|
||||
|
||||
void insertAll(int index, Iterable<Node> iterable) {
|
||||
var item = this[index];
|
||||
_this.insertAllBefore(iterable, item);
|
||||
if (index == length) {
|
||||
addAll(iterable);
|
||||
} else {
|
||||
var item = this[index];
|
||||
_this.insertAllBefore(iterable, item);
|
||||
}
|
||||
}
|
||||
|
||||
void setAll(int index, Iterable<Node> iterable) {
|
||||
|
|
Loading…
Reference in a new issue