mirror of
https://github.com/dzeiocom/libs.git
synced 2025-04-23 11:22:15 +00:00
Added Auto completion :D (#15)
Signed-off-by: Florian BOUILLON <florian.bouillon@delta-wings.net>
This commit is contained in:
parent
799c0269c2
commit
6eb91f57a6
@ -157,13 +157,15 @@ export default class DOMElement<T extends HTMLElement = HTMLElement> {
|
|||||||
public data(key: string): string | null
|
public data(key: string): string | null
|
||||||
public data(key: string, value: string | null): this
|
public data(key: string, value: string | null): this
|
||||||
public data(key: string, value?: string | null): this | string | null {
|
public data(key: string, value?: string | null): this | string | null {
|
||||||
// @ts-ignore
|
// @ts-ignore Ignore because data-elements aren't valid attrs for an HTMLElement
|
||||||
return this.attr(`data-${key}`, value)
|
return this.attr(`data-${key}`, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
public style(key: string, value?: string | number) {
|
public style(key: keyof CSSStyleDeclaration): CSSStyleDeclaration[typeof key]
|
||||||
|
public style(key: keyof CSSStyleDeclaration, value: CSSStyleDeclaration[typeof key]): this
|
||||||
|
public style(key: keyof CSSStyleDeclaration, value?: CSSStyleDeclaration[typeof key]) {
|
||||||
if (typeof value === 'undefined') {
|
if (typeof value === 'undefined') {
|
||||||
return this.item.style[key as any]
|
return this.item.style[key]
|
||||||
}
|
}
|
||||||
this.item.style[key as any] = value as string
|
this.item.style[key as any] = value as string
|
||||||
return this
|
return this
|
||||||
|
Loading…
x
Reference in New Issue
Block a user