• Attempts to build a CSS selector string for the specified dataset object. Note that the values of the dataset object are coerced to a string and null excludes a value but only includes a key. If tagName is specified, it is included in the resulting selector.

    Parameters

    • dataset: Dataset

      Object with key of dataset key and value of dataset value.

    • OptionaltagName: TagName

      Optional tag name for the element.

    Returns CssSelector

    CSS selector based on the specified dataset.

    Dataset Object With null Value

    selectDatasetEntries({ someThing: null });
    // `[data-some-thing]`

    Data Object with Value

    selectDatasetEntries({ someThing: "stuff" });
    // `[data-some-thing="stuff"]`

    Data Object with Value and Tag

    selectDatasetEntries({ someThing: "stuff", otherThing: "doodles" }, "a");
    // `a[data-some-thing="stuff"][data-other-thing="doodles"]`
MMNEPVFCICPMFPCPTTAAATR