Attribute selectors and html5 data-type

Can I use an attribute selector in conjunction with an html5 data-type?
e.g :

CSS : H1[data-type=“red” ]{color : red}

code :<h1 data-type=“red”>content</h1>

This works, and validates, but is it semantic?

Any thoughts?

Thanks!