| 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 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1056 overrideAttributeApi(definition.prototype); | 1056 overrideAttributeApi(definition.prototype); |
| 1057 // 7.1.5: Register the DEFINITION with DOCUMENT | 1057 // 7.1.5: Register the DEFINITION with DOCUMENT |
| 1058 registerDefinition(name, definition); | 1058 registerDefinition(name, definition); |
| 1059 // 7.1.7. Run custom element constructor generation algorithm with PROTOTYPE | 1059 // 7.1.7. Run custom element constructor generation algorithm with PROTOTYPE |
| 1060 // 7.1.8. Return the output of the previous step. | 1060 // 7.1.8. Return the output of the previous step. |
| 1061 definition.ctor = generateConstructor(definition); | 1061 definition.ctor = generateConstructor(definition); |
| 1062 definition.ctor.prototype = definition.prototype; | 1062 definition.ctor.prototype = definition.prototype; |
| 1063 // force our .constructor to be our actual constructor | 1063 // force our .constructor to be our actual constructor |
| 1064 definition.prototype.constructor = definition.ctor; | 1064 definition.prototype.constructor = definition.ctor; |
| 1065 // if initial parsing is complete | 1065 // if initial parsing is complete |
| 1066 if (scope.ready) { | 1066 if (scope.ready || scope.performedInitialDocumentUpgrade) { |
| 1067 // upgrade any pre-existing nodes of this type | 1067 // upgrade any pre-existing nodes of this type |
| 1068 scope.upgradeAll(document); | 1068 scope.upgradeAll(document); |
| 1069 } | 1069 } |
| 1070 return definition.ctor; | 1070 return definition.ctor; |
| 1071 } | 1071 } |
| 1072 | 1072 |
| 1073 function ancestry(extnds) { | 1073 function ancestry(extnds) { |
| 1074 var extendee = registry[extnds]; | 1074 var extendee = registry[extnds]; |
| 1075 if (extendee) { | 1075 if (extendee) { |
| 1076 return ancestry(extendee.extends).concat([extendee]); | 1076 return ancestry(extendee.extends).concat([extendee]); |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1378 | 1378 |
| 1379 })(); | 1379 })(); |
| 1380 (function(){ | 1380 (function(){ |
| 1381 | 1381 |
| 1382 // bootstrap parsing | 1382 // bootstrap parsing |
| 1383 function bootstrap() { | 1383 function bootstrap() { |
| 1384 // parse document | 1384 // parse document |
| 1385 CustomElements.parser.parse(document); | 1385 CustomElements.parser.parse(document); |
| 1386 // one more pass before register is 'live' | 1386 // one more pass before register is 'live' |
| 1387 CustomElements.upgradeDocument(document); | 1387 CustomElements.upgradeDocument(document); |
| 1388 CustomElements.performedInitialDocumentUpgrade = true; |
| 1388 // choose async | 1389 // choose async |
| 1389 var async = window.Platform && Platform.endOfMicrotask ? | 1390 var async = window.Platform && Platform.endOfMicrotask ? |
| 1390 Platform.endOfMicrotask : | 1391 Platform.endOfMicrotask : |
| 1391 setTimeout; | 1392 setTimeout; |
| 1392 async(function() { | 1393 async(function() { |
| 1393 // set internal 'ready' flag, now document.register will trigger | 1394 // set internal 'ready' flag, now document.register will trigger |
| 1394 // synchronous upgrades | 1395 // synchronous upgrades |
| 1395 CustomElements.ready = true; | 1396 CustomElements.ready = true; |
| 1396 // capture blunt profiling data | 1397 // capture blunt profiling data |
| 1397 CustomElements.readyTime = Date.now(); | 1398 CustomElements.readyTime = Date.now(); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1459 | 1460 |
| 1460 // override | 1461 // override |
| 1461 fns.forEach(function(fn) { | 1462 fns.forEach(function(fn) { |
| 1462 CustomElements[fn] = function(inNode) { | 1463 CustomElements[fn] = function(inNode) { |
| 1463 return original[fn](ShadowDOMPolyfill.wrapIfNeeded(inNode)); | 1464 return original[fn](ShadowDOMPolyfill.wrapIfNeeded(inNode)); |
| 1464 }; | 1465 }; |
| 1465 }); | 1466 }); |
| 1466 } | 1467 } |
| 1467 | 1468 |
| 1468 })(); | 1469 })(); |
| OLD | NEW |