Chromium Code Reviews| Index: pkg/web_components/lib/dart_support.js |
| diff --git a/pkg/web_components/lib/dart_support.js b/pkg/web_components/lib/dart_support.js |
| index 77948eb29438f24008c56db0078bc50a54249610..895adcc92803b21b3e9bdd69df710d0ee8c1ed98 100644 |
| --- a/pkg/web_components/lib/dart_support.js |
| +++ b/pkg/web_components/lib/dart_support.js |
| @@ -68,12 +68,19 @@ |
| // Updates document.registerElement so Dart can see when Javascript custom |
| // elements are created, and wrap them to provide a Dart friendly API. |
| (function (doc) { |
| - var upgraders = {}; |
| + var upgraders = {}; // upgrader associated with a custom-tag. |
| + var unpatchableTags = {}; // set of custom-tags that can't be patched. |
| var originalRegisterElement = doc.registerElement; |
| if (!originalRegisterElement) { |
| throw new Error('document.registerElement is not present.'); |
| } |
| + function reportError(name) { |
| + console.error("Couldn't patch prototype to notify Dart when " + name + |
| + " elements are created. This can be fixed by making the " + |
| + "createdCallback in " + name + " a configurable property."); |
| + } |
| + |
| function registerElement(name, options) { |
| var proto, extendsOption; |
| if (options !== undefined) { |
| @@ -98,9 +105,8 @@ |
| descriptor['value'] = newCallback; |
| Object.defineProperty(proto, 'createdCallback', descriptor); |
| } else { |
| - console.error("Couldn't patch prototype to notify Dart when " + name + |
| - " elements are created. This can be fixed by making the " + |
| - "createdCallback in " + name + " a configurable property."); |
| + unpatchableTags[name] = true; |
| + if (!!upgraders[name]) reportError(name); |
|
Jennifer Messerly
2014/06/12 00:51:05
I don't think !! is needed here.
Siggi Cherem (dart-lang)
2014/06/12 01:03:23
Done.
|
| } |
| return originalRegisterElement.call(this, name, options); |
| } |
| @@ -114,6 +120,7 @@ |
| return; |
| } |
| upgraders[name] = upgrader; |
| + if (unpatchableTags[name]) reportError(name); |
| } |