Element, EventTarget, or CSS selector.
Array of dataset keys or dataset filter object to check for.
true
if the target
matches all search criteria.
elements!InvalidElementError
if the specified target
wasn't found.
HTML
<div
id="example"
data-is-active="false"
data-count="30"
data-label="Example"
>
...
</div>
Code
const element = findElement("#example")!;
hasAllDatasetEntries(element, ["data-is-active", "data-count"]);
// true
hasAllDatasetEntries(element, ["isActive", "data-missing"]);
// false
hasAllDatasetEntries(element, { "data-count", 30, "label": null });
// true
Checks if the
target
has all of the dataset entries that match thesearch
criteria.