re-expose Polymer.LegacyElement which layers Polymer 1.x's custom lifecycle (created, attached, attributeChanged) on top of Polymer.LegacyApi

This commit is contained in:
Steven Orvell
2017-01-30 11:40:27 -08:00
parent 0ad4d40acf
commit f67c28b5ef
4 changed files with 58 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!-- bc compatible Polymer({...}); enabled via Polymer.LegacyElement -->
<link rel="import" href="src/legacy/legacy-element.html">
<link rel="import" href="src/legacy/polymer-fn.html">
<link rel="import" href="src/legacy/class.html">

View File

@@ -30,7 +30,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
return class LegacyApi extends mixin {
serialize(value) {
return this._serializeAttribute(value);
}

View File

@@ -0,0 +1,56 @@
<!--
@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
-->
<link rel="import" href="legacy-api.html">
<script>
'use strict';
Polymer.LegacyElementMixin = Polymer.Utils.dedupingMixin(function(base) {
return class extends Polymer.LegacyApiMixin(base) {
constructor() {
super();
this.created();
}
created() {}
connectedCallback() {
super.connectedCallback();
this.isAttached = true;
this.attached();
}
attached() {}
disconnectedCallback() {
super.disconnectedCallback();
this.isAttached = false;
this.detached();
}
detached() {}
attributeChangedCallback(name, old, value) {
if (old !== value) {
super.attributeChangedCallback(name, old, value);
this.attributeChanged(name, old, value);
}
}
attributeChanged() {}
}
});
Polymer.LegacyElement = Polymer.LegacyElementMixin(HTMLElement);
</script>

View File

@@ -41,6 +41,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
'unit/async.html',
'unit/behaviors.html',
'unit/polymer.element.html',
'unit/polymer.legacyelement.html',
'unit/debounce.html',
'unit/inheritance.html',
'unit/path.html',