For AI agents: a documentation index is available at /llms.txt. Markdown versions of all pages are available by appending .md to any URL.

Interface MediaList

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

MDN Reference

interface MediaList {
    length: number;
    mediaText: string;
    "[iterator]"(): ArrayIterator<string>;
    appendMedium(medium: string): void;
    deleteMedium(medium: string): void;
    item(index: number): string | null;
    toString(): string;
    [index: number]: string;
}

Indexable

  • [index: number]: string
Index
length: number

The read-only length property of the MediaList interface returns the number of media queries in the list.

MDN Reference

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

  • 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

    • medium: string

    Returns void

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

    MDN Reference

    Parameters

    • medium: string

    Returns void

  • 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

    • index: number

    Returns string | null

  • Returns string

Was this helpful?