| Index: lib/dom/templates/html/impl/impl_Element.darttemplate
|
| diff --git a/lib/dom/templates/html/impl/impl_Element.darttemplate b/lib/dom/templates/html/impl/impl_Element.darttemplate
|
| index fc2842d02aec158e2ee99ab902f5c8115768eec6..869de4810ba660711eee5edda7c95136aefd80ab 100644
|
| --- a/lib/dom/templates/html/impl/impl_Element.darttemplate
|
| +++ b/lib/dom/templates/html/impl/impl_Element.darttemplate
|
| @@ -624,14 +624,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,
|
| @@ -720,6 +720,14 @@ class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
|
| 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;
|
|
|
| @@ -735,6 +743,63 @@ $else
|
| // TODO(vsm): Implement noSuchMethod or similar for dart2js.
|
| $endif
|
|
|
| +$if 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 */
|
| + void insertAdjacentElement(String where, Element element) {
|
| + if (JS('bool', '!!this.insertAdjacentElement')) {
|
| + _insertAdjacentElement(where, element);
|
| + } else {
|
| + _insertAdjacentNode(where, element);
|
| + }
|
| + }
|
| +
|
| + void _insertAdjacentElement(String where, String text)
|
| + 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}");
|
| + }
|
| + }
|
| +$endif
|
| +
|
| $!MEMBERS
|
| }
|
|
|
|
|