Closed martypdx closed 11 months ago
In this project, property
does not reflect DOM Web IDL properties, because the DOM does not reflect all attributes, and sometimes uses inconsistent casing. For more info, see https://github.com/wooorm/property-information/issues/18#issuecomment-1878518778. And, I’d recommend https://github.com/syntax-tree/hast-util-to-dom, if you want to turn hast into DOM nodes.
Given:
Current behavior reports property as
dataTitle
which will not work against the dom element to access or set the value. Correct access is throughp.dataset.title
. While there are tests, the tested behavior is incorrect for web standard platform.Custom data attributes (
data-*
) appear on the corresponding element as camelCase sub-properties ofelement.dataset
Given how the rest of library is structured, my suggestion would be to add a
.dataset = true
to info and object report the property without thedata-
prefix.LMK if I am misunderstanding the purpose of this library. I'm going off the first line that intent is to be web standard:
Also happy to make PRs if I can help