jellyfin-web/dashboard-ui/bower_components/polymer/polymer-micro.html

710 lines
17 KiB
HTML
Raw Normal View History

2015-06-19 09:36:51 -07:00
<!--
@license
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
2016-01-27 23:38:15 -07:00
-->
<script>(function () {
2015-06-19 09:36:51 -07:00
function resolve() {
document.body.removeAttribute('unresolved');
}
if (window.WebComponents) {
addEventListener('WebComponentsReady', resolve);
} else {
if (document.readyState === 'interactive' || document.readyState === 'complete') {
resolve();
} else {
addEventListener('DOMContentLoaded', resolve);
}
}
2016-05-31 20:02:29 -07:00
}());window.Polymer = {
2015-06-19 09:36:51 -07:00
Settings: function () {
2016-03-18 18:40:03 -07:00
var settings = window.Polymer || {};
2015-12-14 08:43:03 -07:00
var parts = location.search.slice(1).split('&');
for (var i = 0, o; i < parts.length && (o = parts[i]); i++) {
2015-06-19 09:36:51 -07:00
o = o.split('=');
2016-03-18 18:40:03 -07:00
o[0] && (settings[o[0]] = o[1] || true);
}
settings.wantShadow = settings.dom === 'shadow';
settings.hasShadow = Boolean(Element.prototype.createShadowRoot);
settings.nativeShadow = settings.hasShadow && !window.ShadowDOMPolyfill;
settings.useShadow = settings.wantShadow && settings.hasShadow;
settings.hasNativeImports = Boolean('import' in document.createElement('link'));
settings.useNativeImports = settings.hasNativeImports;
settings.useNativeCustomElements = !window.CustomElements || window.CustomElements.useNative;
settings.useNativeShadow = settings.useShadow && settings.nativeShadow;
settings.usePolyfillProto = !settings.useNativeCustomElements && !Object.__proto__;
return settings;
2015-06-19 09:36:51 -07:00
}()
2016-05-31 20:02:29 -07:00
};(function () {
2015-06-19 09:36:51 -07:00
var userPolymer = window.Polymer;
window.Polymer = function (prototype) {
2015-08-28 17:52:37 -07:00
if (typeof prototype === 'function') {
prototype = prototype.prototype;
}
if (!prototype) {
prototype = {};
2015-06-19 09:36:51 -07:00
}
2015-08-28 17:52:37 -07:00
var factory = desugar(prototype);
prototype = factory.prototype;
2015-09-05 21:53:37 -07:00
var options = { prototype: prototype };
if (prototype.extends) {
options.extends = prototype.extends;
}
2015-06-19 09:36:51 -07:00
Polymer.telemetry._registrate(prototype);
document.registerElement(prototype.is, options);
2015-08-28 17:52:37 -07:00
return factory;
2015-06-19 09:36:51 -07:00
};
var desugar = function (prototype) {
2015-07-16 16:52:41 -07:00
var base = Polymer.Base;
if (prototype.extends) {
base = Polymer.Base._getExtendedPrototype(prototype.extends);
}
prototype = Polymer.Base.chainObject(prototype, base);
2015-06-19 09:36:51 -07:00
prototype.registerCallback();
return prototype.constructor;
};
if (userPolymer) {
for (var i in userPolymer) {
Polymer[i] = userPolymer[i];
}
}
Polymer.Class = desugar;
}());
Polymer.telemetry = {
registrations: [],
_regLog: function (prototype) {
console.log('[' + prototype.is + ']: registered');
},
_registrate: function (prototype) {
this.registrations.push(prototype);
Polymer.log && this._regLog(prototype);
},
dumpRegistrations: function () {
this.registrations.forEach(this._regLog);
}
2016-05-31 20:02:29 -07:00
};Object.defineProperty(window, 'currentImport', {
2015-06-19 09:36:51 -07:00
enumerable: true,
configurable: true,
get: function () {
return (document._currentScript || document.currentScript).ownerDocument;
}
2016-05-31 20:02:29 -07:00
});Polymer.RenderStatus = {
2015-08-08 09:16:34 -07:00
_ready: false,
_callbacks: [],
whenReady: function (cb) {
if (this._ready) {
cb();
} else {
this._callbacks.push(cb);
}
},
_makeReady: function () {
this._ready = true;
2015-12-14 08:43:03 -07:00
for (var i = 0; i < this._callbacks.length; i++) {
this._callbacks[i]();
}
2015-08-08 09:16:34 -07:00
this._callbacks = [];
},
_catchFirstRender: function () {
requestAnimationFrame(function () {
Polymer.RenderStatus._makeReady();
});
2015-12-14 08:43:03 -07:00
},
_afterNextRenderQueue: [],
_waitingNextRender: false,
afterNextRender: function (element, fn, args) {
this._watchNextRender();
this._afterNextRenderQueue.push([
element,
fn,
args
]);
},
_watchNextRender: function () {
if (!this._waitingNextRender) {
this._waitingNextRender = true;
var fn = function () {
Polymer.RenderStatus._flushNextRender();
};
if (!this._ready) {
this.whenReady(fn);
} else {
requestAnimationFrame(fn);
}
}
},
_flushNextRender: function () {
var self = this;
setTimeout(function () {
self._flushRenderCallbacks(self._afterNextRenderQueue);
self._afterNextRenderQueue = [];
self._waitingNextRender = false;
});
},
_flushRenderCallbacks: function (callbacks) {
for (var i = 0, h; i < callbacks.length; i++) {
h = callbacks[i];
h[1].apply(h[0], h[2] || Polymer.nar);
}
2015-08-08 09:16:34 -07:00
}
};
if (window.HTMLImports) {
HTMLImports.whenReady(function () {
Polymer.RenderStatus._catchFirstRender();
});
} else {
Polymer.RenderStatus._catchFirstRender();
}
Polymer.ImportStatus = Polymer.RenderStatus;
2016-05-31 20:02:29 -07:00
Polymer.ImportStatus.whenLoaded = Polymer.ImportStatus.whenReady;(function () {
2016-03-18 18:40:03 -07:00
'use strict';
var settings = Polymer.Settings;
2015-06-19 09:36:51 -07:00
Polymer.Base = {
2015-07-16 16:52:41 -07:00
__isPolymerInstance__: true,
2015-06-19 09:36:51 -07:00
_addFeature: function (feature) {
this.extend(this, feature);
},
registerCallback: function () {
2015-08-28 17:52:37 -07:00
this._desugarBehaviors();
this._doBehavior('beforeRegister');
2015-06-19 09:36:51 -07:00
this._registerFeatures();
2016-03-18 18:40:03 -07:00
if (!settings.lazyRegister) {
this.ensureRegisterFinished();
}
2015-06-19 09:36:51 -07:00
},
createdCallback: function () {
2016-03-18 18:40:03 -07:00
if (!this.__hasRegisterFinished) {
this._ensureRegisterFinished(this.__proto__);
}
2015-06-19 09:36:51 -07:00
Polymer.telemetry.instanceCount++;
this.root = this;
this._doBehavior('created');
this._initFeatures();
},
2016-03-18 18:40:03 -07:00
ensureRegisterFinished: function () {
this._ensureRegisterFinished(this);
},
_ensureRegisterFinished: function (proto) {
if (proto.__hasRegisterFinished !== proto.is) {
proto.__hasRegisterFinished = proto.is;
if (proto._finishRegisterFeatures) {
proto._finishRegisterFeatures();
}
proto._doBehavior('registered');
2016-05-31 20:02:29 -07:00
if (settings.usePolyfillProto && proto !== this) {
proto.extend(this, proto);
}
2016-03-18 18:40:03 -07:00
}
},
2015-06-19 09:36:51 -07:00
attachedCallback: function () {
2015-12-14 08:43:03 -07:00
var self = this;
2015-08-08 09:16:34 -07:00
Polymer.RenderStatus.whenReady(function () {
2015-12-14 08:43:03 -07:00
self.isAttached = true;
self._doBehavior('attached');
});
2015-06-19 09:36:51 -07:00
},
detachedCallback: function () {
2016-05-31 20:02:29 -07:00
var self = this;
Polymer.RenderStatus.whenReady(function () {
self.isAttached = false;
self._doBehavior('detached');
});
2015-06-19 09:36:51 -07:00
},
2015-12-14 08:43:03 -07:00
attributeChangedCallback: function (name, oldValue, newValue) {
2015-08-08 09:16:34 -07:00
this._attributeChangedImpl(name);
2015-12-14 08:43:03 -07:00
this._doBehavior('attributeChanged', [
name,
oldValue,
newValue
]);
2015-06-19 09:36:51 -07:00
},
2015-08-08 09:16:34 -07:00
_attributeChangedImpl: function (name) {
this._setAttributeToProperty(this, name);
},
2015-06-19 09:36:51 -07:00
extend: function (prototype, api) {
if (prototype && api) {
2015-12-14 08:43:03 -07:00
var n$ = Object.getOwnPropertyNames(api);
for (var i = 0, n; i < n$.length && (n = n$[i]); i++) {
2015-06-19 09:36:51 -07:00
this.copyOwnProperty(n, api, prototype);
2015-12-14 08:43:03 -07:00
}
2015-06-19 09:36:51 -07:00
}
return prototype || api;
},
2015-06-25 18:13:51 -07:00
mixin: function (target, source) {
for (var i in source) {
target[i] = source[i];
}
return target;
},
2015-06-19 09:36:51 -07:00
copyOwnProperty: function (name, source, target) {
var pd = Object.getOwnPropertyDescriptor(source, name);
if (pd) {
Object.defineProperty(target, name, pd);
}
},
2016-05-31 20:02:29 -07:00
_logger: function (level, args) {
if (args.length === 1 && Array.isArray(args[0])) {
args = args[0];
}
switch (level) {
case 'log':
case 'warn':
case 'error':
console[level].apply(console, args);
break;
}
},
_log: function () {
var args = Array.prototype.slice.call(arguments, 0);
this._logger('log', args);
},
_warn: function () {
var args = Array.prototype.slice.call(arguments, 0);
this._logger('warn', args);
},
_error: function () {
var args = Array.prototype.slice.call(arguments, 0);
this._logger('error', args);
},
2015-06-19 09:36:51 -07:00
_logf: function () {
2016-05-31 20:02:29 -07:00
return this._logPrefix.concat(this.is).concat(Array.prototype.slice.call(arguments, 0));
2015-06-19 09:36:51 -07:00
}
};
Polymer.Base._logPrefix = function () {
2016-05-31 20:02:29 -07:00
var color = window.chrome && !/edge/i.test(navigator.userAgent) || /firefox/i.test(navigator.userAgent);
2015-06-19 09:36:51 -07:00
return color ? [
'%c[%s::%s]:',
'font-weight: bold; background-color:#EEEE00;'
] : ['[%s::%s]:'];
}();
Polymer.Base.chainObject = function (object, inherited) {
if (object && inherited && object !== inherited) {
if (!Object.__proto__) {
object = Polymer.Base.extend(Object.create(inherited), object);
}
object.__proto__ = inherited;
}
return object;
};
Polymer.Base = Polymer.Base.chainObject(Polymer.Base, HTMLElement.prototype);
2015-07-16 16:52:41 -07:00
if (window.CustomElements) {
Polymer.instanceof = CustomElements.instanceof;
} else {
Polymer.instanceof = function (obj, ctor) {
return obj instanceof ctor;
};
}
Polymer.isInstance = function (obj) {
return Boolean(obj && obj.__isPolymerInstance__);
};
2015-06-19 09:36:51 -07:00
Polymer.telemetry.instanceCount = 0;
2016-05-31 20:02:29 -07:00
}());(function () {
2015-06-19 09:36:51 -07:00
var modules = {};
2015-08-08 09:16:34 -07:00
var lcModules = {};
2015-08-20 20:27:11 -07:00
var findModule = function (id) {
return modules[id] || lcModules[id.toLowerCase()];
};
2015-06-19 09:36:51 -07:00
var DomModule = function () {
return document.createElement('dom-module');
};
DomModule.prototype = Object.create(HTMLElement.prototype);
2015-07-23 19:48:10 -07:00
Polymer.Base.extend(DomModule.prototype, {
constructor: DomModule,
createdCallback: function () {
this.register();
},
register: function (id) {
2016-02-22 21:20:13 -07:00
id = id || this.id || this.getAttribute('name') || this.getAttribute('is');
2015-06-19 09:36:51 -07:00
if (id) {
this.id = id;
modules[id] = this;
2015-08-08 09:16:34 -07:00
lcModules[id.toLowerCase()] = this;
2015-06-19 09:36:51 -07:00
}
2015-07-23 19:48:10 -07:00
},
import: function (id, selector) {
2015-08-28 17:52:37 -07:00
if (id) {
2015-08-20 20:27:11 -07:00
var m = findModule(id);
2015-06-19 09:36:51 -07:00
if (!m) {
2015-12-14 08:43:03 -07:00
forceDomModulesUpgrade();
2015-08-20 20:27:11 -07:00
m = findModule(id);
2015-06-19 09:36:51 -07:00
}
2015-07-23 19:48:10 -07:00
if (m && selector) {
m = m.querySelector(selector);
2015-06-19 09:36:51 -07:00
}
return m;
2015-07-23 19:48:10 -07:00
}
2015-08-28 17:52:37 -07:00
}
2015-07-23 19:48:10 -07:00
});
2015-06-19 09:36:51 -07:00
var cePolyfill = window.CustomElements && !CustomElements.useNative;
document.registerElement('dom-module', DomModule);
2015-12-14 08:43:03 -07:00
function forceDomModulesUpgrade() {
2015-06-19 09:36:51 -07:00
if (cePolyfill) {
var script = document._currentScript || document.currentScript;
2015-12-14 08:43:03 -07:00
var doc = script && script.ownerDocument || document;
var modules = doc.querySelectorAll('dom-module');
for (var i = modules.length - 1, m; i >= 0 && (m = modules[i]); i--) {
if (m.__upgraded__) {
return;
} else {
CustomElements.upgrade(m);
}
2015-06-19 09:36:51 -07:00
}
}
}
2016-05-31 20:02:29 -07:00
}());Polymer.Base._addFeature({
2015-06-19 09:36:51 -07:00
_prepIs: function () {
if (!this.is) {
var module = (document._currentScript || document.currentScript).parentNode;
if (module.localName === 'dom-module') {
var id = module.id || module.getAttribute('name') || module.getAttribute('is');
this.is = id;
}
}
2015-08-08 09:16:34 -07:00
if (this.is) {
this.is = this.is.toLowerCase();
}
2015-06-19 09:36:51 -07:00
}
2016-05-31 20:02:29 -07:00
});Polymer.Base._addFeature({
2015-06-19 09:36:51 -07:00
behaviors: [],
2015-08-28 17:52:37 -07:00
_desugarBehaviors: function () {
2015-06-19 09:36:51 -07:00
if (this.behaviors.length) {
2015-08-28 17:52:37 -07:00
this.behaviors = this._desugarSomeBehaviors(this.behaviors);
2015-06-19 09:36:51 -07:00
}
2015-08-28 17:52:37 -07:00
},
_desugarSomeBehaviors: function (behaviors) {
2016-02-22 21:20:13 -07:00
var behaviorSet = [];
2015-08-28 17:52:37 -07:00
behaviors = this._flattenBehaviorsList(behaviors);
for (var i = behaviors.length - 1; i >= 0; i--) {
2016-02-22 21:20:13 -07:00
var b = behaviors[i];
if (behaviorSet.indexOf(b) === -1) {
this._mixinBehavior(b);
behaviorSet.unshift(b);
}
2015-08-28 17:52:37 -07:00
}
2016-02-22 21:20:13 -07:00
return behaviorSet;
2015-06-19 09:36:51 -07:00
},
_flattenBehaviorsList: function (behaviors) {
var flat = [];
2015-12-14 08:43:03 -07:00
for (var i = 0; i < behaviors.length; i++) {
var b = behaviors[i];
2015-06-19 09:36:51 -07:00
if (b instanceof Array) {
flat = flat.concat(this._flattenBehaviorsList(b));
} else if (b) {
flat.push(b);
} else {
this._warn(this._logf('_flattenBehaviorsList', 'behavior is null, check for missing or 404 import'));
}
2015-12-14 08:43:03 -07:00
}
2015-06-19 09:36:51 -07:00
return flat;
},
_mixinBehavior: function (b) {
2015-12-14 08:43:03 -07:00
var n$ = Object.getOwnPropertyNames(b);
for (var i = 0, n; i < n$.length && (n = n$[i]); i++) {
if (!Polymer.Base._behaviorProperties[n] && !this.hasOwnProperty(n)) {
2015-06-19 09:36:51 -07:00
this.copyOwnProperty(n, b, this);
}
}
},
2015-08-28 17:52:37 -07:00
_prepBehaviors: function () {
this._prepFlattenedBehaviors(this.behaviors);
},
_prepFlattenedBehaviors: function (behaviors) {
for (var i = 0, l = behaviors.length; i < l; i++) {
this._prepBehavior(behaviors[i]);
}
this._prepBehavior(this);
},
2015-06-19 09:36:51 -07:00
_doBehavior: function (name, args) {
2015-12-14 08:43:03 -07:00
for (var i = 0; i < this.behaviors.length; i++) {
this._invokeBehavior(this.behaviors[i], name, args);
}
2015-06-19 09:36:51 -07:00
this._invokeBehavior(this, name, args);
},
_invokeBehavior: function (b, name, args) {
var fn = b[name];
if (fn) {
fn.apply(this, args || Polymer.nar);
}
},
_marshalBehaviors: function () {
2015-12-14 08:43:03 -07:00
for (var i = 0; i < this.behaviors.length; i++) {
this._marshalBehavior(this.behaviors[i]);
}
2015-06-19 09:36:51 -07:00
this._marshalBehavior(this);
}
});
2015-12-14 08:43:03 -07:00
Polymer.Base._behaviorProperties = {
hostAttributes: true,
2016-01-27 23:38:15 -07:00
beforeRegister: true,
2015-12-14 08:43:03 -07:00
registered: true,
properties: true,
observers: true,
listeners: true,
created: true,
attached: true,
detached: true,
attributeChanged: true,
ready: true
2016-05-31 20:02:29 -07:00
};Polymer.Base._addFeature({
2015-06-19 09:36:51 -07:00
_getExtendedPrototype: function (tag) {
return this._getExtendedNativePrototype(tag);
},
_nativePrototypes: {},
_getExtendedNativePrototype: function (tag) {
var p = this._nativePrototypes[tag];
if (!p) {
var np = this.getNativePrototype(tag);
p = this.extend(Object.create(np), Polymer.Base);
this._nativePrototypes[tag] = p;
}
return p;
},
getNativePrototype: function (tag) {
return Object.getPrototypeOf(document.createElement(tag));
}
2016-05-31 20:02:29 -07:00
});Polymer.Base._addFeature({
2015-06-19 09:36:51 -07:00
_prepConstructor: function () {
this._factoryArgs = this.extends ? [
this.extends,
this.is
] : [this.is];
var ctor = function () {
return this._factory(arguments);
};
if (this.hasOwnProperty('extends')) {
ctor.extends = this.extends;
}
Object.defineProperty(this, 'constructor', {
value: ctor,
writable: true,
configurable: true
});
ctor.prototype = this;
},
_factory: function (args) {
var elt = document.createElement.apply(document, this._factoryArgs);
if (this.factoryImpl) {
this.factoryImpl.apply(elt, args);
}
return elt;
}
2016-05-31 20:02:29 -07:00
});Polymer.nob = Object.create(null);
2015-06-19 09:36:51 -07:00
Polymer.Base._addFeature({
properties: {},
getPropertyInfo: function (property) {
var info = this._getPropertyInfo(property, this.properties);
if (!info) {
2015-12-14 08:43:03 -07:00
for (var i = 0; i < this.behaviors.length; i++) {
info = this._getPropertyInfo(property, this.behaviors[i].properties);
if (info) {
return info;
}
}
2015-06-19 09:36:51 -07:00
}
return info || Polymer.nob;
},
_getPropertyInfo: function (property, properties) {
var p = properties && properties[property];
if (typeof p === 'function') {
p = properties[property] = { type: p };
}
if (p) {
p.defined = true;
}
return p;
2015-12-14 08:43:03 -07:00
},
_prepPropertyInfo: function () {
this._propertyInfo = {};
2016-02-22 21:20:13 -07:00
for (var i = 0; i < this.behaviors.length; i++) {
2015-12-14 08:43:03 -07:00
this._addPropertyInfo(this._propertyInfo, this.behaviors[i].properties);
}
this._addPropertyInfo(this._propertyInfo, this.properties);
this._addPropertyInfo(this._propertyInfo, this._propertyEffects);
},
_addPropertyInfo: function (target, source) {
if (source) {
var t, s;
for (var i in source) {
t = target[i];
s = source[i];
if (i[0] === '_' && !s.readOnly) {
continue;
}
if (!target[i]) {
target[i] = {
type: typeof s === 'function' ? s : s.type,
readOnly: s.readOnly,
attribute: Polymer.CaseMap.camelToDashCase(i)
};
} else {
if (!t.type) {
t.type = s.type;
}
if (!t.readOnly) {
t.readOnly = s.readOnly;
}
}
}
}
2015-06-19 09:36:51 -07:00
}
2016-05-31 20:02:29 -07:00
});Polymer.CaseMap = {
2015-06-19 09:36:51 -07:00
_caseMap: {},
2016-02-22 21:20:13 -07:00
_rx: {
dashToCamel: /-[a-z]/g,
camelToDash: /([A-Z])/g
},
2015-06-19 09:36:51 -07:00
dashToCamelCase: function (dash) {
2016-02-22 21:20:13 -07:00
return this._caseMap[dash] || (this._caseMap[dash] = dash.indexOf('-') < 0 ? dash : dash.replace(this._rx.dashToCamel, function (m) {
2015-06-19 09:36:51 -07:00
return m[1].toUpperCase();
2016-02-22 21:20:13 -07:00
}));
2015-06-19 09:36:51 -07:00
},
camelToDashCase: function (camel) {
2016-02-22 21:20:13 -07:00
return this._caseMap[camel] || (this._caseMap[camel] = camel.replace(this._rx.camelToDash, '-$1').toLowerCase());
2015-06-19 09:36:51 -07:00
}
2016-05-31 20:02:29 -07:00
};Polymer.Base._addFeature({
2015-06-19 09:36:51 -07:00
_addHostAttributes: function (attributes) {
2015-12-14 08:43:03 -07:00
if (!this._aggregatedAttributes) {
this._aggregatedAttributes = {};
}
2015-06-19 09:36:51 -07:00
if (attributes) {
this.mixin(this._aggregatedAttributes, attributes);
}
},
_marshalHostAttributes: function () {
2015-12-14 08:43:03 -07:00
if (this._aggregatedAttributes) {
2015-06-19 09:36:51 -07:00
this._applyAttributes(this, this._aggregatedAttributes);
2015-12-14 08:43:03 -07:00
}
2015-06-19 09:36:51 -07:00
},
_applyAttributes: function (node, attr$) {
for (var n in attr$) {
if (!this.hasAttribute(n) && n !== 'class') {
2015-12-14 08:43:03 -07:00
var v = attr$[n];
this.serializeValueToAttribute(v, n, this);
2015-06-19 09:36:51 -07:00
}
}
},
_marshalAttributes: function () {
this._takeAttributesToModel(this);
},
_takeAttributesToModel: function (model) {
2015-12-14 08:43:03 -07:00
if (this.hasAttributes()) {
for (var i in this._propertyInfo) {
var info = this._propertyInfo[i];
if (this.hasAttribute(info.attribute)) {
this._setAttributeToProperty(model, info.attribute, i, info);
}
}
2015-06-19 09:36:51 -07:00
}
},
2015-12-14 08:43:03 -07:00
_setAttributeToProperty: function (model, attribute, property, info) {
2015-06-19 09:36:51 -07:00
if (!this._serializing) {
2016-02-22 21:20:13 -07:00
property = property || Polymer.CaseMap.dashToCamelCase(attribute);
2015-12-14 08:43:03 -07:00
info = info || this._propertyInfo && this._propertyInfo[property];
if (info && !info.readOnly) {
var v = this.getAttribute(attribute);
model[property] = this.deserialize(v, info.type);
2015-06-19 09:36:51 -07:00
}
}
},
_serializing: false,
2015-12-14 08:43:03 -07:00
reflectPropertyToAttribute: function (property, attribute, value) {
2015-06-19 09:36:51 -07:00
this._serializing = true;
2015-12-14 08:43:03 -07:00
value = value === undefined ? this[property] : value;
this.serializeValueToAttribute(value, attribute || Polymer.CaseMap.camelToDashCase(property));
2015-06-19 09:36:51 -07:00
this._serializing = false;
},
serializeValueToAttribute: function (value, attribute, node) {
var str = this.serialize(value);
2015-12-14 08:43:03 -07:00
node = node || this;
if (str === undefined) {
node.removeAttribute(attribute);
} else {
node.setAttribute(attribute, str);
}
2015-06-19 09:36:51 -07:00
},
deserialize: function (value, type) {
switch (type) {
case Number:
value = Number(value);
break;
case Boolean:
2016-02-22 21:20:13 -07:00
value = value != null;
2015-06-19 09:36:51 -07:00
break;
case Object:
try {
value = JSON.parse(value);
} catch (x) {
}
break;
case Array:
try {
value = JSON.parse(value);
} catch (x) {
value = null;
console.warn('Polymer::Attributes: couldn`t decode Array as JSON');
}
break;
case Date:
value = new Date(value);
break;
case String:
default:
break;
}
return value;
},
serialize: function (value) {
switch (typeof value) {
case 'boolean':
return value ? '' : undefined;
case 'object':
if (value instanceof Date) {
2016-02-22 21:20:13 -07:00
return value.toString();
2015-06-19 09:36:51 -07:00
} else if (value) {
try {
return JSON.stringify(value);
} catch (x) {
return '';
}
}
default:
return value != null ? value : undefined;
}
}
2016-05-31 20:02:29 -07:00
});Polymer.version = "1.5.0";Polymer.Base._addFeature({
2015-06-19 09:36:51 -07:00
_registerFeatures: function () {
this._prepIs();
this._prepBehaviors();
this._prepConstructor();
2015-12-14 08:43:03 -07:00
this._prepPropertyInfo();
2015-06-19 09:36:51 -07:00
},
_prepBehavior: function (b) {
this._addHostAttributes(b.hostAttributes);
},
_marshalBehavior: function (b) {
},
_initFeatures: function () {
this._marshalHostAttributes();
this._marshalBehaviors();
}
2016-05-31 20:02:29 -07:00
});</script>