Element, EventTarget, or CSS selector.
Array of dataset keys or dataset filter object to check for.
true
if the target
matches some 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")!;
hasSomeDatasetEntries(element, ["data-is-active", "data-missing"]);
// true
hasSomeDatasetEntries(element, ["data-missing"]);
// false
hasSomeDatasetEntries(element, {
"data-is-active": false,
count, 30,
missing: null,
});
// true
Checks if the
target
has some of the dataset entries that match thesearch
criteria.