|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- import HTMLElement from '../html-element/HTMLElement';
- import IHTMLFormElement from '../html-form-element/IHTMLFormElement';
- import ValidityState from '../validity-state/ValidityState';
- import IHTMLLabelElement from '../html-label-element/IHTMLLabelElement';
- import INodeList from '../node/INodeList';
- import IHTMLSelectElement from './IHTMLSelectElement';
- import Event from '../../event/Event';
- import IHTMLOptionElement from '../html-option-element/IHTMLOptionElement';
- import IHTMLOptGroupElement from '../html-opt-group-element/IHTMLOptGroupElement';
- import IHTMLOptionsCollection from '../html-option-element/IHTMLOptionsCollection';
- import INode from '../node/INode';
- /**
- * HTML Select Element.
- *
- * Reference:
- * https://developer.mozilla.org/en-US/docs/Web/API/HTMLSelectElement.
- */
- export default class HTMLSelectElement extends HTMLElement implements IHTMLSelectElement {
- labels: INodeList<IHTMLLabelElement>;
- readonly options: IHTMLOptionsCollection;
- onchange: (event: Event) => void | null;
- oninput: (event: Event) => void | null;
- /**
- * Returns name.
- *
- * @returns Name.
- */
- get name(): string;
- /**
- * Sets name.
- *
- * @param name Name.
- */
- set name(name: string);
- /**
- * Returns disabled.
- *
- * @returns Disabled.
- */
- get disabled(): boolean;
- /**
- * Sets disabled.
- *
- * @param disabled Disabled.
- */
- set disabled(disabled: boolean);
- /**
- * Returns multiple.
- *
- * @returns Multiple.
- */
- get multiple(): boolean;
- /**
- * Sets multiple.
- *
- * @param multiple Multiple.
- */
- set multiple(multiple: boolean);
- /**
- * Returns autofocus.
- *
- * @returns Autofocus.
- */
- get autofocus(): boolean;
- /**
- * Sets autofocus.
- *
- * @param autofocus Autofocus.
- */
- set autofocus(autofocus: boolean);
- /**
- * Returns length.
- *
- * @returns length.
- */
- get length(): number;
- /**
- * Sets length.
- *
- * @param length Length.
- */
- set length(length: number);
- /**
- * Returns required.
- *
- * @returns Required.
- */
- get required(): boolean;
- /**
- * Sets required.
- *
- * @param required Required.
- */
- set required(required: boolean);
- /**
- * Returns type.
- *
- * @returns type.
- */
- get type(): string;
- /**
- * Returns value.
- *
- * @returns Value.
- */
- get value(): string;
- /**
- * Sets value.
- *
- * @param value Value.
- */
- set value(value: string);
- /**
- * Returns value.
- *
- * @returns Value.
- */
- get selectedIndex(): number;
- /**
- * Sets value.
- *
- * @param selectedIndex Selected index.
- */
- set selectedIndex(selectedIndex: number);
- /**
- * Returns the parent form element.
- *
- * @returns Form.
- */
- get form(): IHTMLFormElement;
- /**
- * Returns validity state.
- *
- * @returns Validity state.
- */
- get validity(): ValidityState;
- /**
- * Returns "true" if it will validate.
- *
- * @returns "true" if it will validate.
- */
- get willValidate(): boolean;
- /**
- * Returns item from options collection by index.
- *
- * @param index Index.
- */
- item(index: number): IHTMLOptionElement | IHTMLOptGroupElement;
- /**
- * Adds new option to options collection.
- *
- * @param element HTMLOptionElement or HTMLOptGroupElement to add.
- * @param before HTMLOptionElement or index number.
- */
- add(element: IHTMLOptionElement | IHTMLOptGroupElement, before?: number | IHTMLOptionElement | IHTMLOptGroupElement): void;
- /**
- * Removes indexed element from collection or the select element.
- *
- * @param [index] Index.
- */
- remove(index?: number): void;
- /**
- * @override
- */
- appendChild(node: INode): INode;
- /**
- * @override
- */
- insertBefore(newNode: INode, referenceNode: INode | null): INode;
- /**
- * @override
- */
- removeChild(node: INode): INode;
- /**
- * Resets the option selectedness.
- *
- * Based on:
- * https://github.com/jsdom/jsdom/blob/master/lib/jsdom/living/nodes/HTMLSelectElement-impl.js
- *
- * @param [newOption] Optional new option element to be selected.
- * @see https://html.spec.whatwg.org/multipage/form-elements.html#selectedness-setting-algorithm
- */
- _resetOptionSelectednes(newOption?: IHTMLOptionElement): void;
- /**
- * Returns display size.
- *
- * @returns Display size.
- */
- protected _getDisplaySize(): number;
- /**
- * Updates index properties.
- *
- * @param previousLength Length before the update.
- * @param newLength Length after the update.
- */
- protected _updateIndexProperties(previousLength: number, newLength: number): void;
- }
|