Are empty HTML data attributes valid?

Yes, perfectly valid. In your case, data-modal-target would represent a boolean attribute:

2.4.2 Boolean attributes

The presence of a boolean attribute on an element represents the true
value, and the absence of the attribute represents the false value.

Leave a Comment