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

Unified Diff: third_party/polymer/v0_8/components-chromium/polymer/src/lib/base-extracted.js

Issue 1082403004: Import Polymer 0.8 and several key elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Also remove polymer/explainer Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: third_party/polymer/v0_8/components-chromium/polymer/src/lib/base-extracted.js
diff --git a/third_party/polymer/v0_8/components-chromium/polymer/src/lib/base-extracted.js b/third_party/polymer/v0_8/components-chromium/polymer/src/lib/base-extracted.js
new file mode 100644
index 0000000000000000000000000000000000000000..5df6b71daef923c6fab39703c0297276c76f5460
--- /dev/null
+++ b/third_party/polymer/v0_8/components-chromium/polymer/src/lib/base-extracted.js
@@ -0,0 +1,82 @@
+
+
+ Polymer.Base = {
+
+ // pluggable features
+ // `this` context is a prototype, not an instance
+ _addFeature: function(feature) {
+ this.extend(this, feature);
+ },
+
+ // `this` context is a prototype, not an instance
+ registerCallback: function() {
+ this._registerFeatures(); // abstract
+ this._doBehavior('registered'); // abstract
+ },
+
+ createdCallback: function() {
+ Polymer.telemetry.instanceCount++;
+ this.root = this;
+ this._doBehavior('created'); // abstract
+ this._initFeatures(); // abstract
+ },
+
+ // reserved for canonical behavior
+ attachedCallback: function() {
+ this.isAttached = true;
+ this._doBehavior('attached'); // abstract
+ },
+
+ // reserved for canonical behavior
+ detachedCallback: function() {
+ this.isAttached = false;
+ this._doBehavior('detached'); // abstract
+ },
+
+ // reserved for canonical behavior
+ attributeChangedCallback: function(name) {
+ this.setAttributeToProperty(this, name);
+ this._doBehavior('attributeChanged', arguments); // abstract
+ },
+
+ // copy own properties from `api` to `prototype`
+ extend: function(prototype, api) {
+ if (prototype && api) {
+ Object.getOwnPropertyNames(api).forEach(function(n) {
+ this.copyOwnProperty(n, api, prototype);
+ }, this);
+ }
+ return prototype || api;
+ },
+
+ copyOwnProperty: function(name, source, target) {
+ var pd = Object.getOwnPropertyDescriptor(source, name);
+ if (pd) {
+ Object.defineProperty(target, name, pd);
+ }
+ }
+
+ };
+
+ if (Object.__proto__) {
+ Polymer.Base.chainObject = function(object, inherited) {
+ if (object && inherited && object !== inherited) {
+ object.__proto__ = inherited;
+ }
+ return object;
+ };
+ } else {
+ Polymer.Base.chainObject = function(object, inherited) {
+ if (object && inherited && object !== inherited) {
+ var chained = Object.create(inherited);
+ object = Polymer.Base.extend(chained, object);
+ }
+ return object;
+ };
+ }
+
+ Polymer.Base = Polymer.Base.chainObject(Polymer.Base, HTMLElement.prototype);
+
+ // TODO(sjmiles): ad hoc telemetry
+ Polymer.telemetry.instanceCount = 0;
+

Powered by Google App Engine
This is Rietveld 408576698