• Checks if the target has some of the dataset entries that match the search criteria.

    Parameters

    • target: null | Target

      Element, EventTarget, or CSS selector.

    • search: DatasetSearch

      Array of dataset keys or dataset filter object to check for.

    Returns boolean

    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