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

Unified Diff: sdk/lib/html/dartium/html_dartium.dart

Issue 12374060: Adding Node.insertAllBefore (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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 | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | tests/html/node_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/dartium/html_dartium.dart
diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart
index 515811b5f5dc66bde3f75774cf9c8ee1f1e575e0..e78e148125c389e2de60598553cbb37f6eea63fb 100644
--- a/sdk/lib/html/dartium/html_dartium.dart
+++ b/sdk/lib/html/dartium/html_dartium.dart
@@ -6605,7 +6605,7 @@ class DataView extends ArrayBufferView {
@DomName('DataView.getInt8')
@DocsEditable
- Object getInt8({int byteOffset}) native "DataView_getInt8_Callback";
+ int getInt8(int byteOffset) native "DataView_getInt8_Callback";
int getUint16(int byteOffset, {bool littleEndian}) {
if (?littleEndian) {
@@ -6639,7 +6639,7 @@ class DataView extends ArrayBufferView {
@DomName('DataView.getUint8')
@DocsEditable
- Object getUint8({int byteOffset}) native "DataView_getUint8_Callback";
+ int getUint8(int byteOffset) native "DataView_getUint8_Callback";
void setFloat32(int byteOffset, num value, {bool littleEndian}) {
if (?littleEndian) {
@@ -18592,9 +18592,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]);
}
}
@@ -18814,6 +18815,31 @@ class Node extends EventTarget {
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);
+ }
+ }
+ }
+
Node.internal() : super.internal();
@DomName('Node.childNodes')
@@ -34538,6 +34564,11 @@ class TestRunner {
class _Utils {
+ static double dateTimeToDouble(DateTime dateTime) =>
+ dateTime.millisecondsSinceEpoch.toDouble();
+ static DateTime doubleToDateTime(double dateTime) =>
+ new DateTime.fromMillisecondsSinceEpoch(dateTime.toInt());
+
static List convertToList(List list) {
// FIXME: [possible optimization]: do not copy the array if Dart_IsArray is fine w/ it.
final length = list.length;
« no previous file with comments | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | tests/html/node_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698