The example you show is valid. (Just like using disabled
or checked
in a form. Only xHTML
force the presence of a value)
Although, the value returned is not a boolean. When you query this resource, you'll get an empty string for any empty data-*
attributes.
Like so:
domNode.dataset.draggable; // log ""
domNode.dataset.notAdded; // log null
So, you just have to check it:
var isDraggable = (domNode.dataset.draggable != null)
Edit
Stupid to haven't tell it before. But, you can just check if the attribute exist if you want a boolean:
domNode.hasAttribute("data-draggable");