Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(870)

Unified Diff: sdk/lib/html/dart2js/html_dart2js.dart

Side-by-side diff isn't available for this file because of its large size.
Issue 12374060: Adding Node.insertAllBefore (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
Download patch
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/dart2js/html_dart2js.dart
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index b5f053bb405298f757074af33ecdd785be526ca9..a0cfe96536a34eae7ecfe309e5a386420c691155 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -5926,7 +5926,7 @@ class DataView extends ArrayBufferView native "*DataView" {
@DomName('DataView.getInt8')
@DocsEditable
- Object getInt8({int byteOffset}) native;
+ int getInt8(int byteOffset) native;
@DomName('DataView.getUint16')
@DocsEditable
@@ -5938,7 +5938,7 @@ class DataView extends ArrayBufferView native "*DataView" {
@DomName('DataView.getUint8')
@DocsEditable
- Object getUint8({int byteOffset}) native;
+ int getUint8(int byteOffset) native;
@DomName('DataView.setFloat32')
@DocsEditable
@@ -17096,9 +17096,10 @@ class _ChildNodeListLazy implements List {
void addAll(Iterable<Node> iterable) {
if (iterable is _ChildNodeListLazy) {
- if (iterable._this != _this) {
+ if (!identical(iterable._this, _this)) {
// Optimized route for copying between nodes.
for (var i = 0, len = iterable.length; i < len; ++i) {
+ // Should use $dom_firstChild, Bug 8886.
_this.$dom_appendChild(iterable[0]);
}
}
@@ -17318,6 +17319,31 @@ class Node extends EventTarget native "*Node" {
return this;
}
+ /**
+ * Inserts all of the nodes into this node directly before refChild.
+ *
+ * See also:
+ *
+ * * [insertBefore]
+ */
+ Node insertAllBefore(Iterable<Node> newNodes, Node refChild) {
+ if (newNodes is _ChildNodeListLazy) {
+ if (identical(newNodes._this, this)) {
+ throw new ArgumentError(newNodes);
+ }
+
+ // Optimized route for copying between nodes.
+ for (var i = 0, len = newNodes.length; i < len; ++i) {
+ // Should use $dom_firstChild, Bug 8886.
+ this.insertBefore(newNodes[0], refChild);
+ }
+ } else {
+ for (var node in newNodes) {
+ this.insertBefore(node, refChild);
+ }
+ }
+ }
+
@JSName('childNodes')
@DomName('Node.childNodes')
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698