| OLD | NEW |
| 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 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1169 // TODO(sjmiles): 'used' allows us to only copy the 'youngest' version of | 1169 // TODO(sjmiles): 'used' allows us to only copy the 'youngest' version of |
| 1170 // any property. This set should be precalculated. We also need to | 1170 // any property. This set should be precalculated. We also need to |
| 1171 // consider this for supporting 'super'. | 1171 // consider this for supporting 'super'. |
| 1172 var used = {}; | 1172 var used = {}; |
| 1173 // start with inSrc | 1173 // start with inSrc |
| 1174 var p = inSrc; | 1174 var p = inSrc; |
| 1175 // sometimes the default is HTMLUnknownElement.prototype instead of | 1175 // sometimes the default is HTMLUnknownElement.prototype instead of |
| 1176 // HTMLElement.prototype, so we add a test | 1176 // HTMLElement.prototype, so we add a test |
| 1177 // the idea is to avoid mixing in native prototypes, so adding | 1177 // the idea is to avoid mixing in native prototypes, so adding |
| 1178 // the second test is WLOG | 1178 // the second test is WLOG |
| 1179 while (p !== inNative && p !== HTMLUnknownElement.prototype) { | 1179 while (p && p !== inNative && p !== HTMLUnknownElement.prototype) { |
| 1180 var keys = Object.getOwnPropertyNames(p); | 1180 var keys = Object.getOwnPropertyNames(p); |
| 1181 for (var i=0, k; k=keys[i]; i++) { | 1181 for (var i=0, k; k=keys[i]; i++) { |
| 1182 if (!used[k]) { | 1182 if (!used[k]) { |
| 1183 Object.defineProperty(inTarget, k, | 1183 Object.defineProperty(inTarget, k, |
| 1184 Object.getOwnPropertyDescriptor(p, k)); | 1184 Object.getOwnPropertyDescriptor(p, k)); |
| 1185 used[k] = 1; | 1185 used[k] = 1; |
| 1186 } | 1186 } |
| 1187 } | 1187 } |
| 1188 p = Object.getPrototypeOf(p); | 1188 p = Object.getPrototypeOf(p); |
| 1189 } | 1189 } |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1460 | 1460 |
| 1461 // override | 1461 // override |
| 1462 fns.forEach(function(fn) { | 1462 fns.forEach(function(fn) { |
| 1463 CustomElements[fn] = function(inNode) { | 1463 CustomElements[fn] = function(inNode) { |
| 1464 return original[fn](ShadowDOMPolyfill.wrapIfNeeded(inNode)); | 1464 return original[fn](ShadowDOMPolyfill.wrapIfNeeded(inNode)); |
| 1465 }; | 1465 }; |
| 1466 }); | 1466 }); |
| 1467 } | 1467 } |
| 1468 | 1468 |
| 1469 })(); | 1469 })(); |
| OLD | NEW |