CSSKeywordValue

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Die CSSKeywordValue Schnittstelle der CSS Typed Object Model API erstellt ein Objekt zur Darstellung von CSS-Schlüsselwörtern und anderen Identifikatoren.

Der Name der Schnittstelleninstanz ist ein stringifier, was bedeutet, dass sie überall, wo ein String erwartet wird, den Wert von CSSKeyword.value zurückgeben wird.

CSSStyleValue CSSKeywordValue

Konstruktor

CSSKeywordValue()

Erstellt ein neues CSSKeywordValue-Objekt.

Instanzeigenschaften

CSSKeywordValue.value

Gibt den Wert des CSSKeywordValue zurück oder setzt ihn.

Instanzmethoden

Erbt Methoden von CSSStyleValue.

Beispiele

Das folgende Beispiel setzt die CSS-Eigenschaft display auf ihre Standardwerte zurück, indem das Inline-Attribut style auf style="display: initial" gesetzt wird, wenn es im Entwicklertools-Inspektor betrachtet wird.

js
let myElement = document.getElementById("myElement").attributeStyleMap;
myElement.set("display", new CSSKeywordValue("initial"));

console.log(myElement.get("display").value); // 'initial'

Spezifikationen

Specification
CSS Typed OM Level 1
# keywordvalue-objects

Browser-Kompatibilität

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
CSSKeywordValue
CSSKeywordValue() constructor
value

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
See implementation notes.

Siehe auch