Eliminate dynamic calls to firstChild, remove and _innerHtml.
Change-Id: If984af54620727929ea8deb182226ce8d6514bb6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255581
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
diff --git a/pkg/compiler/test/analyses/api_allowed.json b/pkg/compiler/test/analyses/api_allowed.json
index 96aac80..2cfc954 100644
--- a/pkg/compiler/test/analyses/api_allowed.json
+++ b/pkg/compiler/test/analyses/api_allowed.json
@@ -28,9 +28,7 @@
},
"org-dartlang-sdk:///lib/html/dart2js/html_dart2js.dart": {
"Dynamic access of 'style'.": 1,
- "Dynamic invocation of 'remove'.": 2,
- "Dynamic update to 'dart.dom.html::_innerHtml'.": 1,
- "Dynamic access of 'firstChild'.": 2,
+ "Dynamic invocation of 'remove'.": 1,
"Dynamic access of 'tagName'.": 2,
"Dynamic invocation of 'call'.": 2,
"Dynamic invocation of 'dart.dom.html::_initKeyboardEvent'.": 1,
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index 6f210df..1107935 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -13783,7 +13783,7 @@
_parseDocument!.createElement("body") as BodyElement;
}
- var contextElement;
+ Element contextElement;
if (this is BodyElement) {
contextElement = _parseDocument!.body!;
} else {
@@ -13802,7 +13802,7 @@
fragment = _parseDocument!.createDocumentFragment();
while (contextElement.firstChild != null) {
- fragment.append(contextElement.firstChild);
+ fragment.append(contextElement.firstChild!);
}
}
if (contextElement != _parseDocument!.body) {