Adjust polymer attributeChangedCallback to spec. (#40800)

* Adjust polymer attributeChangedCallback to spec.

According to the specification at:
    https://html.spec.whatwg.org/multipage/custom-elements.html#custom-element-reactions

`attributeChangedCallback` is called "given the attribute's local name,
old value, new value, and namespace as arguments". This also matches
browser implementations and understanding of how things work from
discussion with Polymer engineers (CC @rictic).

* Fix a dtslint issue with TypeScript <3.0.

TypeScript 3.0 and before appears to be confused with the `extends`
property declared here.
This commit is contained in:
Martin Probst
2019-12-10 10:50:56 -05:00
committed by Orta
parent 70d072f390
commit 3ccf5966d7
2 changed files with 3 additions and 1 deletions
+2 -1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/Polymer/polymer
// Definitions by: Louis Grignon <https://github.com/lgrignon>, Suguru Inatomi <https://github.com/laco0416>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.1
import { CustomElementConstructor } from "webcomponents.js";
@@ -195,7 +196,7 @@ declare global {
detachedCallback?():void;
attributeChangedCallback?(name: string):void;
attributeChangedCallback?(attributeName: string, oldValue: string|null, newValue: string|null, namespace: string|null): void;
extend?(prototype: Object, api: Object):Object;
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/webcomponents/webcomponentsjs, http://webcomponents.org
// Definitions by: Adi Dahiya <https://github.com/adidahiya>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.1
export interface CustomElementInit {
prototype: HTMLElement;