Skip to main content

MediaList

The MediaList interface represents the media queries of a stylesheet, e.g., those set using a <link> element's media attribute.

MDN Reference

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.

MDN Reference

Parameters

ParameterType
mediumstring

Returns

void


deleteMedium()

deleteMedium(medium): void;

The deleteMedium() method of the MediaList interface removes from this MediaList the given media query.

MDN Reference

Parameters

ParameterType
mediumstring

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.

MDN Reference

Parameters

ParameterType
indexnumber

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.

MDN Reference


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.

MDN Reference