Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. DOMStringList

DOMStringList

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨July 2015⁩.

Note: This feature is available inWeb Workers.

TheDOMStringList interface is a legacy type returned by some APIs and represents a non-modifiable list of strings (DOMString).

This interface was anattempt to create an unmodifiable list and only continues to be supported to not break code that's already using it. Modern APIs represent list structures using types based on JavaScriptarrays, thus making many array methods available, and at the same time imposing additional semantics on their usage (such as making their items read-only).

These historical reasons do not mean that you as a developer should avoidDOMStringList. You don't createDOMStringList objects yourself, but you get them from APIs such asLocation.ancestorOrigins, and these APIs are not deprecated. However, be careful of the semantic differences from a real array.

This interface is used inIndexedDB and in theLocation API:

Instance properties

DOMStringList.lengthRead only

Returns the size of the list.

Instance methods

DOMStringList.item()

Returns a string from the list with the given index.

DOMStringList.contains()

Returns a boolean indicating whether the given string is in the list.

Specifications

Specification
HTML
# the-domstringlist-interface

Browser compatibility

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp