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

Side by Side Diff: lib/interop_support.js

Issue 839013003: CustomElementProxy annotation (Closed) Base URL: git@github.com:dart-lang/web-components.git@master
Patch Set: update initialize dependency Created 5 years, 11 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 unified diff | Download patch
« no previous file with comments | « lib/interop.dart ('k') | pubspec.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Updates document.registerElement so Dart can see when Javascript custom 5 // Updates document.registerElement so Dart can see when Javascript custom
6 // elements are created, and wrap them to provide a Dart friendly API. 6 // elements are created, and wrap them to provide a Dart friendly API.
7 (function (doc) { 7 (function (doc) {
8 if (window._dart_register_element_interop_support) return; 8 if (window._dart_register_element_interop_support) return;
9 window._dart_register_element_interop_support = true; 9 window._dart_register_element_interop_support = true;
10 10
(...skipping 17 matching lines...) Expand all
28 var proto, extendsOption; 28 var proto, extendsOption;
29 if (options !== undefined) { 29 if (options !== undefined) {
30 proto = options.prototype; 30 proto = options.prototype;
31 } else { 31 } else {
32 proto = Object.create(HTMLElement.prototype); 32 proto = Object.create(HTMLElement.prototype);
33 options = {protoptype: proto}; 33 options = {protoptype: proto};
34 } 34 }
35 35
36 var original = proto.createdCallback; 36 var original = proto.createdCallback;
37 var newCallback = function() { 37 var newCallback = function() {
38 original.call(this); 38 if (original) original.call(this);
39 var name = (this.getAttribute('is') || this.localName).toLowerCase(); 39 var name = (this.getAttribute('is') || this.localName).toLowerCase();
40 var upgrader = upgraders[name]; 40 var upgrader = upgraders[name];
41 if (upgrader) { 41 if (upgrader) {
42 upgrader(this); 42 upgrader(this);
43 } else if (upgradeOldElements) { 43 } else if (upgradeOldElements) {
44 // Save this element in case we can upgrade it later when an upgrader is 44 // Save this element in case we can upgrade it later when an upgrader is
45 // registered. 45 // registered.
46 var list = pendingElements[name]; 46 var list = pendingElements[name];
47 if (!list) { 47 if (!list) {
48 list = pendingElements[name] = []; 48 list = pendingElements[name] = [];
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 return originalGetUnknownTag(o, tag); 117 return originalGetUnknownTag(o, tag);
118 } 118 }
119 }; 119 };
120 }); 120 });
121 } 121 }
122 122
123 doc._registerDartTypeUpgrader = registerDartTypeUpgrader; 123 doc._registerDartTypeUpgrader = registerDartTypeUpgrader;
124 doc._onlyUpgradeNewElements = onlyUpgradeNewElements; 124 doc._onlyUpgradeNewElements = onlyUpgradeNewElements;
125 doc.registerElement = registerElement; 125 doc.registerElement = registerElement;
126 })(document); 126 })(document);
OLDNEW
« no previous file with comments | « lib/interop.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698