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

Side by Side Diff: pkg/custom_element/lib/custom-elements.debug.js

Issue 112613003: Fix for dart2js mirrors caching with custom elements (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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/custom_element/lib/custom-elements.min.js » ('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) 2012 The Polymer Authors. All rights reserved. 1 // Copyright (c) 2012 The Polymer Authors. All rights reserved.
2 // 2 //
3 // Redistribution and use in source and binary forms, with or without 3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are 4 // modification, are permitted provided that the following conditions are
5 // met: 5 // met:
6 // 6 //
7 // * Redistributions of source code must retain the above copyright 7 // * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer. 8 // notice, this list of conditions and the following disclaimer.
9 // * Redistributions in binary form must reproduce the above 9 // * Redistributions in binary form must reproduce the above
10 // copyright notice, this list of conditions and the following disclaimer 10 // copyright notice, this list of conditions and the following disclaimer
(...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1144 1144
1145 function implement(element, definition) { 1145 function implement(element, definition) {
1146 // prototype swizzling is best 1146 // prototype swizzling is best
1147 if (Object.__proto__) { 1147 if (Object.__proto__) {
1148 element.__proto__ = definition.prototype; 1148 element.__proto__ = definition.prototype;
1149 } else { 1149 } else {
1150 // where above we can re-acquire inPrototype via 1150 // where above we can re-acquire inPrototype via
1151 // getPrototypeOf(Element), we cannot do so when 1151 // getPrototypeOf(Element), we cannot do so when
1152 // we use mixin, so we install a magic reference 1152 // we use mixin, so we install a magic reference
1153 customMixin(element, definition.prototype, definition.native); 1153 customMixin(element, definition.prototype, definition.native);
1154
1155 // Dart note: make sure we pick up the right constructor.
1156 // dart2js depends on this for dart:mirrors caching to work.
1157 // See tests/html/custom/mirrors_test.dart
1158 element.constructor = definition.prototype.constructor;
1154 element.__proto__ = definition.prototype; 1159 element.__proto__ = definition.prototype;
1155 } 1160 }
1156 } 1161 }
1157 1162
1158 function customMixin(inTarget, inSrc, inNative) { 1163 function customMixin(inTarget, inSrc, inNative) {
1159 // TODO(sjmiles): 'used' allows us to only copy the 'youngest' version of 1164 // TODO(sjmiles): 'used' allows us to only copy the 'youngest' version of
1160 // any property. This set should be precalculated. We also need to 1165 // any property. This set should be precalculated. We also need to
1161 // consider this for supporting 'super'. 1166 // consider this for supporting 'super'.
1162 var used = {}; 1167 var used = {};
1163 // start with inSrc 1168 // start with inSrc
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 if (window.CustomElements && !CustomElements.useNative) { 1488 if (window.CustomElements && !CustomElements.useNative) {
1484 var originalImportNode = Document.prototype.importNode; 1489 var originalImportNode = Document.prototype.importNode;
1485 Document.prototype.importNode = function(node, deep) { 1490 Document.prototype.importNode = function(node, deep) {
1486 var imported = originalImportNode.call(this, node, deep); 1491 var imported = originalImportNode.call(this, node, deep);
1487 CustomElements.upgradeAll(imported); 1492 CustomElements.upgradeAll(imported);
1488 return imported; 1493 return imported;
1489 } 1494 }
1490 } 1495 }
1491 1496
1492 })(); 1497 })();
OLDNEW
« no previous file with comments | « no previous file | pkg/custom_element/lib/custom-elements.min.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698