Skip to content

Commit e173fc3

Browse files
committed
fix: Support pre-ES2022
1 parent 7479234 commit e173fc3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,7 @@ import { h, cloneElement, render, hydrate } from 'preact';
88
* @type {import('./index.d.ts').default}
99
*/
1010
export default function register(Component, tagName, propNames, options) {
11-
propNames ??= Component.observedAttributes || [];
12-
1311
class PreactElement extends HTMLElement {
14-
static formAssociated = Component.formAssociated || false;
15-
static observedAttributes = propNames;
16-
1712
constructor() {
1813
super();
1914

@@ -61,6 +56,11 @@ export default function register(Component, tagName, propNames, options) {
6156
}
6257
}
6358

59+
PreactElement.formAssociated = Component.formAssociated || false;
60+
61+
propNames = propNames || Component.observedAttributes || [];
62+
PreactElement.observedAttributes = propNames;
63+
6464
// Keep DOM properties and Preact props in sync
6565
propNames.forEach((name) => {
6666
Object.defineProperty(PreactElement.prototype, name, {

0 commit comments

Comments
 (0)