/
HTMLOptGroupElement.ts
54 lines (50 loc) · 1.05 KB
/
HTMLOptGroupElement.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import HTMLElement from '../html-element/HTMLElement';
import IHTMLOptGroupElement from './IHTMLOptGroupElement';
/**
* HTML Opt Group Element.
*
* Reference:
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLOptGroupElement.
*/
export default class HTMLOptGroupElement extends HTMLElement implements IHTMLOptGroupElement {
/**
* Returns label.
*
* @returns Label.
*/
public get label(): string {
return this.getAttributeNS(null, 'label') || '';
}
/**
* Sets label.
*
* @param label Label.
*/
public set label(label: string) {
if (!label) {
this.removeAttributeNS(null, 'label');
} else {
this.setAttributeNS(null, 'label', label);
}
}
/**
* Returns disabled.
*
* @returns Disabled.
*/
public get disabled(): boolean {
return this.getAttributeNS(null, 'disabled') !== null;
}
/**
* Sets disabled.
*
* @param disabled Disabled.
*/
public set disabled(disabled: boolean) {
if (!disabled) {
this.removeAttributeNS(null, 'disabled');
} else {
this.setAttributeNS(null, 'disabled', '');
}
}
}