mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
Remove PropertiesElement in favor of PropertiesMixin.
This commit is contained in:
@@ -1,42 +0,0 @@
|
|||||||
<!--
|
|
||||||
@license
|
|
||||||
Copyright (c) 2017 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="../utils/boot.html">
|
|
||||||
<link rel="import" href="../utils/mixin.html">
|
|
||||||
<link rel="import" href="../mixins/properties-mixin.html">
|
|
||||||
|
|
||||||
<script>
|
|
||||||
(function () {
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Base class that provides a simple starting point for creating an element
|
|
||||||
* that declares properties via the `properties` static getter that are
|
|
||||||
* observed. Changes are reported via the `_propertiesChanged` method.
|
|
||||||
* This element provides no specific support for rendering. Users are expected
|
|
||||||
* to create a shadowRoot and put content into it and update it in whatever
|
|
||||||
* way makes sense for the use case.
|
|
||||||
*
|
|
||||||
* @customElement
|
|
||||||
* @polymer
|
|
||||||
* @memberof Polymer
|
|
||||||
* @constructor
|
|
||||||
* @implements {Polymer_PropertiesMixin}
|
|
||||||
* @extends HTMLElement
|
|
||||||
* @appliesMixin Polymer.PropertiesMixin
|
|
||||||
* @summary Base class that provides a simple starting point for creating an
|
|
||||||
* element that declares properties via the `properties` static getter that
|
|
||||||
* are observed
|
|
||||||
*/
|
|
||||||
const PropertiesElement = Polymer.PropertiesMixin(HTMLElement);
|
|
||||||
Polymer.PropertiesElement = PropertiesElement;
|
|
||||||
})();
|
|
||||||
</script>
|
|
||||||
@@ -65,15 +65,15 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the super class constructor for the given class, if it is an
|
* Returns the super class constructor for the given class, if it is an
|
||||||
* instance of the PropertiesClass.
|
* instance of the PropertiesMixin.
|
||||||
*
|
*
|
||||||
* @param {PropertiesClassConstructor} constructor PropertiesClass constructor
|
* @param {PropertiesMixinConstructor} constructor PropertiesMixin constructor
|
||||||
* @return {PropertiesClassConstructor} Super class constructor
|
* @return {PropertiesMixinConstructor} Super class constructor
|
||||||
*/
|
*/
|
||||||
function superForClass(constructor) {
|
function superForClass(constructor) {
|
||||||
const proto = /** @type {PropertiesClassConstructor} */ (constructor).prototype;
|
const proto = /** @type {PropertiesMixinConstructor} */ (constructor).prototype;
|
||||||
const superCtor = Object.getPrototypeOf(proto).constructor;
|
const superCtor = Object.getPrototypeOf(proto).constructor;
|
||||||
if (superCtor.prototype instanceof PropertiesClass) {
|
if (superCtor.prototype instanceof PropertiesMixin) {
|
||||||
return superCtor;
|
return superCtor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -83,7 +83,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
* given class. Properties not in object format are converted to at
|
* given class. Properties not in object format are converted to at
|
||||||
* least {type}.
|
* least {type}.
|
||||||
*
|
*
|
||||||
* @param {PropertiesClassConstructor} constructor PropertiesClass constructor
|
* @param {PropertiesMixinConstructor} constructor PropertiesMixin constructor
|
||||||
* @return {Object} Memoized properties object
|
* @return {Object} Memoized properties object
|
||||||
*/
|
*/
|
||||||
function ownProperties(constructor) {
|
function ownProperties(constructor) {
|
||||||
@@ -102,7 +102,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
* @implements {Polymer_PropertiesMixin}
|
* @implements {Polymer_PropertiesMixin}
|
||||||
* @unrestricted
|
* @unrestricted
|
||||||
*/
|
*/
|
||||||
class PropertiesClass extends base {
|
class PropertiesMixin extends base {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements standard custom elements getter to observes the attributes
|
* Implements standard custom elements getter to observes the attributes
|
||||||
@@ -203,7 +203,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return PropertiesClass;
|
return PropertiesMixin;
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -54,8 +54,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
'unit/async.html',
|
'unit/async.html',
|
||||||
'unit/behaviors.html',
|
'unit/behaviors.html',
|
||||||
'unit/polymer.element.html',
|
'unit/polymer.element.html',
|
||||||
'unit/polymer.properties-element.html',
|
'unit/polymer.properties-mixin.html',
|
||||||
'unit/polymer.properties-element-with-property-accessors.html',
|
'unit/polymer.properties-mixin-with-property-accessors.html',
|
||||||
'unit/polymer.legacyelement.html',
|
'unit/polymer.legacyelement.html',
|
||||||
'unit/debounce.html',
|
'unit/debounce.html',
|
||||||
'unit/inheritance.html',
|
'unit/inheritance.html',
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<script src="../../../webcomponentsjs/webcomponents-lite.js"></script>
|
<script src="../../../webcomponentsjs/webcomponents-lite.js"></script>
|
||||||
<script src="../../../web-component-tester/browser.js"></script>
|
<script src="../../../web-component-tester/browser.js"></script>
|
||||||
<link rel="import" href="../../lib/elements/properties-element.html">
|
<link rel="import" href="../../lib/mixins/properties-mixin.html">
|
||||||
<link rel="import" href="../../lib/mixins/property-accessors.html">
|
<link rel="import" href="../../lib/mixins/property-accessors.html">
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
<script>
|
<script>
|
||||||
HTMLImports.whenReady(function() {
|
HTMLImports.whenReady(function() {
|
||||||
|
|
||||||
class MyElement extends Polymer.PropertyAccessors(Polymer.PropertiesElement) {
|
class MyElement extends Polymer.PropertyAccessors(Polymer.PropertiesMixin(HTMLElement)) {
|
||||||
|
|
||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
@@ -200,7 +200,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
</test-fixture>
|
</test-fixture>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
suite('class extends Polymer.PropertiesElement', function() {
|
suite('class extends Polymer.PropertiesMixin', function() {
|
||||||
|
|
||||||
var el;
|
var el;
|
||||||
|
|
||||||
@@ -215,7 +215,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
|
|
||||||
test('instanceof', function() {
|
test('instanceof', function() {
|
||||||
assert.instanceOf(el, HTMLElement);
|
assert.instanceOf(el, HTMLElement);
|
||||||
assert.instanceOf(el, Polymer.PropertiesElement);
|
|
||||||
assert.instanceOf(el, window.MyElement);
|
assert.instanceOf(el, window.MyElement);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -261,7 +260,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
|
|
||||||
test('instanceof', function() {
|
test('instanceof', function() {
|
||||||
assert.instanceOf(el, HTMLElement);
|
assert.instanceOf(el, HTMLElement);
|
||||||
assert.instanceOf(el, Polymer.PropertiesElement);
|
|
||||||
assert.instanceOf(el, window.MyElement);
|
assert.instanceOf(el, window.MyElement);
|
||||||
assert.instanceOf(el, window.SubElement);
|
assert.instanceOf(el, window.SubElement);
|
||||||
});
|
});
|
||||||
@@ -311,7 +309,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
|
|
||||||
test('instanceof', function() {
|
test('instanceof', function() {
|
||||||
assert.instanceOf(el, HTMLElement);
|
assert.instanceOf(el, HTMLElement);
|
||||||
assert.instanceOf(el, Polymer.PropertiesElement);
|
|
||||||
assert.instanceOf(el, window.MyElement);
|
assert.instanceOf(el, window.MyElement);
|
||||||
assert.instanceOf(el, window.SubElement);
|
assert.instanceOf(el, window.SubElement);
|
||||||
assert.instanceOf(el, window.SubMixinElement);
|
assert.instanceOf(el, window.SubMixinElement);
|
||||||
@@ -13,14 +13,14 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<script src="../../../webcomponentsjs/webcomponents-lite.js"></script>
|
<script src="../../../webcomponentsjs/webcomponents-lite.js"></script>
|
||||||
<script src="../../../web-component-tester/browser.js"></script>
|
<script src="../../../web-component-tester/browser.js"></script>
|
||||||
<link rel="import" href="../../lib/elements/properties-element.html">
|
<link rel="import" href="../../lib/mixins/properties-mixin.html">
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<dom-module id="my-element">
|
<dom-module id="my-element">
|
||||||
<script>
|
<script>
|
||||||
HTMLImports.whenReady(function() {
|
HTMLImports.whenReady(function() {
|
||||||
|
|
||||||
class MyElement extends Polymer.PropertiesElement {
|
class MyElement extends Polymer.PropertiesMixin(HTMLElement) {
|
||||||
|
|
||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
@@ -220,7 +220,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
</test-fixture>
|
</test-fixture>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
suite('class extends Polymer.PropertiesElement', function() {
|
suite('class extends Polymer.PropertiesMixin', function() {
|
||||||
|
|
||||||
var el;
|
var el;
|
||||||
|
|
||||||
@@ -235,7 +235,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
|
|
||||||
test('instanceof', function() {
|
test('instanceof', function() {
|
||||||
assert.instanceOf(el, HTMLElement);
|
assert.instanceOf(el, HTMLElement);
|
||||||
assert.instanceOf(el, Polymer.PropertiesElement);
|
|
||||||
assert.instanceOf(el, window.MyElement);
|
assert.instanceOf(el, window.MyElement);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -304,7 +303,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
|
|
||||||
test('instanceof', function() {
|
test('instanceof', function() {
|
||||||
assert.instanceOf(el, HTMLElement);
|
assert.instanceOf(el, HTMLElement);
|
||||||
assert.instanceOf(el, Polymer.PropertiesElement);
|
|
||||||
assert.instanceOf(el, window.MyElement);
|
assert.instanceOf(el, window.MyElement);
|
||||||
assert.instanceOf(el, window.SubElement);
|
assert.instanceOf(el, window.SubElement);
|
||||||
});
|
});
|
||||||
@@ -354,7 +352,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
|
|
||||||
test('instanceof', function() {
|
test('instanceof', function() {
|
||||||
assert.instanceOf(el, HTMLElement);
|
assert.instanceOf(el, HTMLElement);
|
||||||
assert.instanceOf(el, Polymer.PropertiesElement);
|
|
||||||
assert.instanceOf(el, window.MyElement);
|
assert.instanceOf(el, window.MyElement);
|
||||||
assert.instanceOf(el, window.SubElement);
|
assert.instanceOf(el, window.SubElement);
|
||||||
assert.instanceOf(el, window.SubMixinElement);
|
assert.instanceOf(el, window.SubMixinElement);
|
||||||
Reference in New Issue
Block a user