domData.clean
Remove data from an element previously added by set.
domData.clean(node, key)
Parameters
- node
{Node}
:The element.
- key
{String}
:The property to remove from the element’s data.
Use
import domData from "can-dom-data";
const element = document.createElement("p");
document.body.appendChild(element);
domData.set(element, "metadata", {
hello: "world"
});
let metadata = domData.get(element, "metadata");
// metadata is {hello: "world"}
domData.clean(element, "metadata");
metadata = domData.get(element, "metadata");
// metadata === undefined after clean() was called