DefinitelyTyped/webcomponents.js/webcomponents.js.d.ts
Michael Matloob 2864d46664 webcomponents.js: Add typings for Element.createShadowRoot (#10330)
* webcomponents.js: Add typings for Element.createShadowRoot

createShadowRoot is deprecated in the official Shadow DOM spec,
but is the way to attach a shadow root in the current released
version of webcomponents.js.

* webcomponents.js: remove spurious extra line

* webcomponents.js: remove readonly modifier

Not supported until TS2.

* webcomponents.js: add Element.shadowRoot property
2016-07-29 00:31:34 +09:00

63 lines
1.5 KiB
TypeScript

// Type definitions for webcomponents.js 0.6.0
// Project: https://github.com/webcomponents/webcomponentsjs
// Definitions by: Adi Dahiya <https://github.com/adidahiya>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace webcomponents {
export interface CustomElementInit {
prototype: HTMLElement;
extends?: string;
}
export interface CustomElementConstructor {
new(): HTMLElement;
}
export interface CustomElementsPolyfill {
hasNative: boolean;
flags: any;
ready: boolean;
useNative: boolean;
}
export interface HTMLImportsPolyfill {
IMPORT_LINK_TYPE: string;
isIE: boolean;
flags: any;
ready: boolean;
rootDocument: Document;
useNative: boolean;
whenReady(callback: () => void): void;
}
export interface ShadowRootPolyfill extends DocumentFragment {
innerHTML: string;
host: Element;
}
export interface Polyfill {
flags: any;
}
}
declare module "webcomponents.js" {
export = webcomponents;
}
interface Element {
createShadowRoot(): webcomponents.ShadowRootPolyfill;
shadowRoot?: webcomponents.ShadowRootPolyfill;
}
interface Document {
registerElement(name: string, prototype: webcomponents.CustomElementInit): webcomponents.CustomElementConstructor;
}
interface Window {
CustomElements: webcomponents.CustomElementsPolyfill;
HTMLImports: webcomponents.HTMLImportsPolyfill;
WebComponents: webcomponents.Polyfill;
}