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

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

Issue 10871088: Revert "Implementing polyfills for insertAdjacent* to get them working on FF." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merging.wq Created 8 years, 4 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 | « lib/dom/templates/html/interface/interface_Element.darttemplate ('k') | lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/html/dart2js/html_dart2js.dart
diff --git a/lib/html/dart2js/html_dart2js.dart b/lib/html/dart2js/html_dart2js.dart
index cfa8687eb1750be4fc65416162c9fae320e50629..39be8b77b636ed9892b869e413db27640c4e0696 100644
--- a/lib/html/dart2js/html_dart2js.dart
+++ b/lib/html/dart2js/html_dart2js.dart
@@ -30,7 +30,7 @@ class _Default {
const _Default();
}
-const _default = const _Default();
+final _default = const _Default();
// Workaround for tags like <cite> that lack their own Element subclass --
// Dart issue 1990.
@@ -5264,14 +5264,6 @@ class _DocumentFragmentImpl extends _NodeImpl implements DocumentFragment native
this._insertAdjacentNode(where, new DocumentFragment.html(text));
}
- void addText(String text) {
- this.insertAdjacentText('beforeend', text);
- }
-
- void addHTML(String text) {
- this.insertAdjacentHTML('beforeend', text);
- }
-
Future<ElementRect> get rect() {
return _createMeasurementFuture(() => const EmptyElementRect(),
new Completer<ElementRect>());
@@ -6089,14 +6081,14 @@ class _ElementRectImpl implements ElementRect {
// TODO(jacobr): should we move these outside of ElementRect to avoid the
// overhead of computing them every time even though they are rarely used.
- final _ClientRectImpl _boundingClientRect;
+ final _ClientRectImpl _boundingClientRect;
final _ClientRectListImpl _clientRects;
_ElementRectImpl(_ElementImpl element) :
client = new _SimpleClientRect(element.$dom_clientLeft,
element.$dom_clientTop,
- element.$dom_clientWidth,
- element.$dom_clientHeight),
+ element.$dom_clientWidth,
+ element.$dom_clientHeight),
offset = new _SimpleClientRect(element.$dom_offsetLeft,
element.$dom_offsetTop,
element.$dom_offsetWidth,
@@ -6185,75 +6177,11 @@ class _ElementImpl extends _NodeImpl implements Element native "*Element" {
new Completer<CSSStyleDeclaration>());
}
- void addText(String text) {
- this.insertAdjacentText('beforeend', text);
- }
-
- void addHTML(String text) {
- this.insertAdjacentHTML('beforeend', text);
- }
-
// Hooks to support custom WebComponents.
var xtag;
// TODO(vsm): Implement noSuchMethod or similar for dart2js.
- /** @domName Element.insertAdjacentText */
- void insertAdjacentText(String where, String text) {
- if (JS('bool', '!!this.insertAdjacentText')) {
- _insertAdjacentText(where, text);
- } else {
- _insertAdjacentNode(where, new Text(text));
- }
- }
-
- void _insertAdjacentText(String where, String text)
- native 'insertAdjacentText';
-
- /** @domName Element.insertAdjacentHTML */
- void insertAdjacentHTML(String where, String text) {
- if (JS('bool', '!!this.insertAdjacentHTML')) {
- _insertAdjacentHTML(where, text);
- } else {
- _insertAdjacentNode(where, new DocumentFragment.html(text));
- }
- }
-
- void _insertAdjacentHTML(String where, String text)
- native 'insertAdjacentHTML';
-
- /** @domName Element.insertAdjacentHTML */
- Element insertAdjacentElement(String where, Element element) {
- if (JS('bool', '!!this.insertAdjacentElement')) {
- _insertAdjacentElement(where, element);
- } else {
- _insertAdjacentNode(where, element);
- }
- return element;
- }
-
- void _insertAdjacentElement(String where, Element element)
- native 'insertAdjacentElement';
-
- void _insertAdjacentNode(String where, Node node) {
- switch (where.toLowerCase()) {
- case 'beforebegin':
- this.parent.insertBefore(node, this);
- break;
- case 'afterbegin':
- this.insertBefore(node, this.nodes.first);
- break;
- case 'beforeend':
- this.nodes.add(node);
- break;
- case 'afterend':
- this.parent.insertBefore(node, this.nextNode);
- break;
- default:
- throw new IllegalArgumentException("Invalid position ${where}");
- }
- }
-
_ElementEventsImpl get on() =>
new _ElementEventsImpl(this);
@@ -6290,6 +6218,12 @@ class _ElementImpl extends _NodeImpl implements Element native "*Element" {
void click() native;
+ _ElementImpl insertAdjacentElement(String where, _ElementImpl element) native;
+
+ void insertAdjacentHTML(String where, String html) native;
+
+ void insertAdjacentText(String where, String text) native;
+
static const int ALLOW_KEYBOARD_INPUT = 1;
int get $dom_childElementCount() native "return this.childElementCount;";
@@ -6387,9 +6321,9 @@ class _ElementImpl extends _NodeImpl implements Element native "*Element" {
// Temporary dispatch hook to support WebComponents.
Function dynamicUnknownElementDispatcher;
-const _START_TAG_REGEXP = const RegExp('<(\\w+)');
+final _START_TAG_REGEXP = const RegExp('<(\\w+)');
class _ElementFactoryProvider {
- static const _CUSTOM_PARENT_TAG_MAP = const {
+ static final _CUSTOM_PARENT_TAG_MAP = const {
'body' : 'html',
'head' : 'html',
'caption' : 'table',
@@ -9842,7 +9776,7 @@ class _MutationObserverImpl implements MutationObserver native "*MutationObserve
}
// TODO: Change to a set when const Sets are available.
- static const _boolKeys =
+ static final _boolKeys =
const {'childList': true,
'attributes': true,
'characterData': true,
@@ -23853,17 +23787,6 @@ interface Element extends Node, NodeSelector default _ElementFactoryProvider {
void set dataAttributes(Map<String, String> value);
/**
- * Adds the specified text as a text node after the last child of this.
- */
- void addText(String text);
-
- /**
- * Parses the specified text as HTML and adds the resulting node after the
- * last child of this.
- */
- void addHTML(String html);
-
- /**
* @domName getClientRects, getBoundingClientRect, clientHeight, clientWidth,
* clientTop, clientLeft, offsetHeight, offsetWidth, offsetTop, offsetLeft,
* scrollHeight, scrollWidth, scrollTop, scrollLeft
« no previous file with comments | « lib/dom/templates/html/interface/interface_Element.darttemplate ('k') | lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698