HighlightRegistry: has() メソッド

Limited availability

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

has()HighlightRegistry インターフェイスのメソッドで、指定された名前の Highlight オブジェクトがこのレジストリーに存在するかどうかを示す論理値を返します。

HighlightRegistryMap 風オブジェクトであるため、これは Map.has() を使用するのと似ています。

構文

js
has(name)

引数

name

レジストリーで存在を検査する Highlight オブジェクトの名前。

返値

指定された名前のハイライトがレジストリーに存在する場合、 true を返します。それ以外の場合、 false を返します。

js
const fooHighlight = new Highlight();
CSS.highlights.set("foo", fooHighlight);

myHighlight.has("foo"); // true
myHighlight.has("bar"); // false

仕様書

Specification
ECMAScript® 2026 Language Specification
# sec-map.prototype.has

ブラウザーの互換性

関連情報