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

Unified Diff: tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate

Issue 1417363003: Fixed improper construction of custom elements. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/html/html_common/conversions_dartium.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate
diff --git a/tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate b/tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate
index 1df549ea47fd88a320ab661c4723aa1138c2c771..6cbf8834c304007bd76bf39e558b0f723418a2c6 100644
--- a/tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate
+++ b/tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate
@@ -436,6 +436,13 @@ $else
//
// See https://github.com/dart-lang/sdk/issues/23666
int creating = 0;
+
+ // If any JS code is hooked we want to call it too.
+ var oldCreatedCallback = elemProto['createdCallback'];
+ var oldAttributeChangedCallback = elemProto['attributeChangedCallback'];
+ var oldAttachedCallback = elemProto['attachedCallback'];
+ var oldDetachedCallback = elemProto['detachedCallback'];
+
// TODO(jacobr): warning:
elemProto['createdCallback'] = js.JsNative.withThis(($this) {
if (_getJSClassName(reflectClass(customElementClass).superclass) != null && creating < 2) {
@@ -474,15 +481,27 @@ $else
creating--;
}
}
+
+ if (oldCreatedCallback != null)
+ oldCreatedCallback.apply([], thisArg: unwrap_jso($this));
});
elemProto['attributeChangedCallback'] = new js.JsFunction.withThis(($this, attrName, oldVal, newVal) {
$this.attributeChanged(attrName, oldVal, newVal);
+
+ if (oldAttributeChangedCallback != null)
+ oldAttributeChangedCallback.apply([], thisArg: unwrap_jso($this));
});
elemProto['attachedCallback'] = new js.JsFunction.withThis(($this) {
$this.attached();
+
+ if (oldAttachedCallback != null)
+ oldAttachedCallback.apply([], thisArg: unwrap_jso($this));
});
elemProto['detachedCallback'] = new js.JsFunction.withThis(($this) {
$this.detached();
+
+ if (oldDetachedCallback != null)
+ oldDetachedCallback.apply([], thisArg: unwrap_jso($this));
});
// document.registerElement('x-foo', {prototype: elemProto, extends: extendsTag});
var jsMap = new js.JsObject.jsify({'prototype': elemProto, 'extends': extendsTag});
« no previous file with comments | « sdk/lib/html/html_common/conversions_dartium.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698