| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/en-US/docs/Web/API/DOMStringList | [Back] [Original] |
Get to know MDN better
This feature is well established and works across many devices and browser versions. Its been available across browsers since July 2015.
Note: This feature is available in Web Workers.
The DOMStringList interface is a legacy type returned by some APIs and represents a non-modifiable list of strings (DOMString).
This interface was an attempt 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 JavaScript arrays, 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 avoid DOMStringList. You don't create DOMStringList objects yourself, but you get them from APIs such as Location.ancestorOrigins, and these APIs are not deprecated. However, be careful of the semantic differences from a real array.
This interface is used in IndexedDB and in the Location API:
DOMStringList.length Read onlyReturns the size of the list.
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.
| Specification |
|---|
| HTML # the-domstringlist-interface |
This page was last modified on Oct 8, 2024 by MDN contributors.
DOMStringListAbortControllerAbortSignalAbstractRangeAttrCDATASectionCharacterDataCommentCustomEventDOMErrorDOMExceptionDOMImplementationDOMParserDOMTokenListDocumentDocumentFragmentDocumentTypeElementEventEventTargetHTMLCollectionMutationObserverMutationRecordNamedNodeMapNodeNodeIteratorNodeListProcessingInstructionQuotaExceededErrorRangeShadowRootStaticRangeTextTreeWalkerXMLDocumentXPathEvaluatorXPathExpressionXPathResultXSLTProcessorYour blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |