Skip to content

Commit

Permalink
Move version to ElementMixin prototype
Browse files Browse the repository at this point in the history
  • Loading branch information
TimvdLippe committed Aug 14, 2018
1 parent 05c62f4 commit 2957e9d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
14 changes: 14 additions & 0 deletions lib/mixins/element-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down
7 changes: 1 addition & 6 deletions polymer-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

/**
Expand All @@ -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';
3 changes: 3 additions & 0 deletions test/unit/polymer.element.html
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,9 @@ <h1>Sub template</h1>
assert.equal(fixtureEl.getAttribute('prop'), 'propValue');
});

test('version', function() {
assert.isOk(el.constructor.polymerElementVersion);
});
});

suite('subclass', function() {
Expand Down

0 comments on commit 2957e9d

Please sign in to comment.