Meeseeks.dataset

You're seeing just the function dataset, go back to Meeseeks module for more information.

Specs

dataset(extractable()) :: %{optional(String.t()) => String.t()} | nil

Returns a map of a result's data attributes, or nil if the result represents a node without attributes.

Behaves like HTMLElement.dataset; only valid data attributes are included, and attribute names have "data-" removed and are converted to camelCase.

See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset

Nil input returns nil.

Examples

iex> import Meeseeks.CSS
iex> result = Meeseeks.one("<div id=example data-x-val=1 data-y-val=2></div>", css("#example"))
#Meeseeks.Result<{ <div id="example" data-x-val="1" data-y-val="2"></div> }>
iex> Meeseeks.dataset(result)
%{"xVal" => "1", "yVal" => "2"}