Move version to ElementMixin prototype

This commit is contained in:
Tim van der Lippe
2018-08-14 12:44:33 +02:00
parent 05c62f4442
commit 2957e9d4b8
3 changed files with 18 additions and 6 deletions

View File

@@ -17,6 +17,12 @@ import { DomModule } from '../elements/dom-module.js';
import { PropertyEffects } from './property-effects.js';
import { PropertiesMixin } from './properties-mixin.js';
/**
* Current Polymer version in Semver notation.
* @type {string} Semver notation of the current version of Polymer.
*/
export const version = '3.0.5';
/**
* Element class mixin that provides the core API for Polymer's meta-programming
* features including template stamping, data-binding, attribute deserialization,
@@ -278,6 +284,14 @@ export const ElementMixin = dedupingMixin(base => {
*/
class PolymerElement extends polymerElementBase {
/**
* Current Polymer version in Semver notation.
* @type {string} Semver notation of the current version of Polymer.
*/
static get polymerElementVersion() {
return version;
}
/**
* Override of PropertiesMixin _finalizeClass to create observers and
* find the template.

View File

@@ -9,6 +9,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*/
import { ElementMixin } from './lib/mixins/element-mixin.js';
export { version } from './lib/mixins/element-mixin.js';
export { html } from './lib/utils/html-tag.js';
/**
@@ -27,9 +28,3 @@ export { html } from './lib/utils/html-tag.js';
* attribute deserialization, and property change observation
*/
export const PolymerElement = ElementMixin(HTMLElement);
/**
* Current Polymer version in Semver notation.
* @type {String} Semver notation of the current version of Polymer.
*/
export const version = '3.0.5';

View File

@@ -397,6 +397,9 @@ suite('class extends Polymer.Element', function() {
assert.equal(fixtureEl.getAttribute('prop'), 'propValue');
});
test('version', function() {
assert.isOk(el.constructor.polymerElementVersion);
});
});
suite('subclass', function() {