mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
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:
@@ -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">
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
56
src/legacy/legacy-element.html
Normal file
56
src/legacy/legacy-element.html
Normal 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>
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user