MediaList
The MediaList interface represents the media queries of a stylesheet, e.g., those set using a <link> element's media attribute.
Indexable
[index: number]: string
Methods
[iterator]()
iterator: ArrayIterator<string>;
Returns
ArrayIterator<string>
appendMedium()
appendMedium(medium): void;
The appendMedium() method of the MediaList interface adds a media query to the list. If the media query is already in the collection, this method does nothing.
Parameters
| Parameter | Type |
|---|---|
medium | string |
Returns
void
deleteMedium()
deleteMedium(medium): void;
The deleteMedium() method of the MediaList interface removes from this MediaList the given media query.
Parameters
| Parameter | Type |
|---|---|
medium | string |
Returns
void
item()
item(index): string | null;
The item() method of the MediaList interface returns the media query at the specified index, or null if the specified index doesn't exist.
Parameters
| Parameter | Type |
|---|---|
index | number |
Returns
string | null
toString()
toString(): string;
Returns
string
Properties
length
readonly length: number;
The read-only length property of the MediaList interface returns the number of media queries in the list.
mediaText
mediaText: string;
The mediaText property of the MediaList interface is a stringifier that returns a string representing the MediaList as text, and also allows you to set a new MediaList.