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

Unified Diff: sdk/lib/html/html_common/conversions_dartium.dart

Issue 1422323006: Fixed Native custom element (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Removed nested ifs 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/dartium/html_dartium.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/html_common/conversions_dartium.dart
diff --git a/sdk/lib/html/html_common/conversions_dartium.dart b/sdk/lib/html/html_common/conversions_dartium.dart
index bdf8e9c17dfa7aa0ae02a71381af48610ac225b3..22738eae6fa2a001fc93c350f58c0890ffb0fd5b 100644
--- a/sdk/lib/html/html_common/conversions_dartium.dart
+++ b/sdk/lib/html/html_common/conversions_dartium.dart
@@ -176,11 +176,19 @@ wrap_jso(jsObject) {
} else {
func = getHtmlCreateFunction(jsTypeName);
if (func == null) {
- if (jsTypeName == 'auto-binding') {
- func = getHtmlCreateFunction('HTMLTemplateElement');
- } else if (jsObject.toString() == "[object HTMLElement]") {
- // One last ditch effort could be a JS custom element.
- func = getHtmlCreateFunction('HTMLElement');
+ // Start walking the prototype chain looking for a JS class.
+ var prototype = jsObject['__proto__'];
+ var keepWalking = true;
+ while (keepWalking && prototype.hasProperty('__proto__')) {
+ prototype = prototype['__proto__'];
+ if (prototype != null && prototype is Element &&
+ prototype.blink_jsObject != null) {
+ // We're a Dart class that's pointing to a JS class.
+ var blinkJso = prototype.blink_jsObject;
+ jsTypeName = blinkJso['constructor']['name'];
+ func = getHtmlCreateFunction(jsTypeName);
+ keepWalking = func == null;
+ }
}
}
}
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698