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

Side by Side Diff: pkg/polymer/lib/src/loader.dart

Issue 197283033: [polymer] fix loader on IE (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/polymer/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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 part of polymer; 5 part of polymer;
6 6
7 /// Annotation used to automatically register polymer elements. 7 /// Annotation used to automatically register polymer elements.
8 class CustomTag { 8 class CustomTag {
9 final String tagName; 9 final String tagName;
10 const CustomTag(this.tagName); 10 const CustomTag(this.tagName);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 ' the platform polyfills.'); 74 ' the platform polyfills.');
75 } 75 }
76 76
77 // TODO(jmesserly): dart:js appears to not callback in the correct zone: 77 // TODO(jmesserly): dart:js appears to not callback in the correct zone:
78 // https://code.google.com/p/dart/issues/detail?id=17301 78 // https://code.google.com/p/dart/issues/detail?id=17301
79 var zone = Zone.current; 79 var zone = Zone.current;
80 80
81 polymerJs.callMethod('whenPolymerReady', 81 polymerJs.callMethod('whenPolymerReady',
82 [zone.bindCallback(() => Polymer._ready.complete())]); 82 [zone.bindCallback(() => Polymer._ready.complete())]);
83 83
84 var jsPolymer = new JsObject.fromBrowserObject( 84 var polyElem = document.createElement('polymer-element');
85 document.createElement('polymer-element')); 85 var proto = new JsObject.fromBrowserObject(polyElem)['__proto__'];
86 86 if (proto is Node) proto = new JsObject.fromBrowserObject(proto);
87 var proto = js.context['Object'].callMethod('getPrototypeOf', [jsPolymer]);
88 if (proto is Node) {
89 proto = new JsObject.fromBrowserObject(proto);
90 }
91 87
92 JsFunction originalRegister = proto['register']; 88 JsFunction originalRegister = proto['register'];
93 if (originalRegister == null) { 89 if (originalRegister == null) {
94 throw new StateError('polymer.js must expose "register" function on ' 90 throw new StateError('polymer.js must expose "register" function on '
95 'polymer-element to enable polymer.dart to interoperate.'); 91 'polymer-element to enable polymer.dart to interoperate.');
96 } 92 }
97 93
98 registerDart(jsElem, String name, String extendee) { 94 registerDart(jsElem, String name, String extendee) {
99 // By the time we get here, we'll know for sure if it is a Dart object 95 // By the time we get here, we'll know for sure if it is a Dart object
100 // or not, because polymer-element will wait for us to notify that 96 // or not, because polymer-element will wait for us to notify that
101 // the @CustomTag was found. 97 // the @CustomTag was found.
102 final type = _getRegisteredType(name); 98 final type = _getRegisteredType(name);
103 if (type != null) { 99 if (type != null) {
104 final extendsDecl = _getDeclaration(extendee); 100 final extendsDecl = _getDeclaration(extendee);
105 return zone.run(() => 101 return zone.run(() =>
106 new PolymerDeclaration(jsElem, name, type, extendsDecl).register()); 102 new PolymerDeclaration(jsElem, name, type, extendsDecl).register());
107 } 103 }
108 // It's a JavaScript polymer element, fall back to the original register. 104 // It's a JavaScript polymer element, fall back to the original register.
109 return originalRegister.apply([name, extendee], thisArg: jsElem); 105 return originalRegister.apply([name, extendee], thisArg: jsElem);
110 } 106 }
111 107
112 proto['register'] = new JsFunction.withThis(registerDart); 108 proto['register'] = new JsFunction.withThis(registerDart);
113 } 109 }
OLDNEW
« no previous file with comments | « no previous file | pkg/polymer/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698