Alpine: Discuss - valid HTML

Created on 29 Apr 2020  路  5Comments  路  Source: alpinejs/alpine

Hi This is more of a discussion of good form.
Html validation throws errors on a lot of the Alpine markup. [ x-data , @click, :class etc ] . I'm using the following Doctype declarations.

<!DOCTYPE html> <html lang="en"> <meta charset="UTF-8">

Is there an advisory on a better doctype declaration to allow these attributes?

There is no fuctional error just a validation error.

Most helpful comment

I think we can easily support an extended syntax data-x-* along the canonical one for those who need to stick with valid html5 syntax if Caleb is cool with that.
It will be just about adding an optional data- prefix to the regexps.

All 5 comments

I don't think there are any doctypes supporting x-* attributes but browser will still render the page even with "invalid" attributes.
Does it cause a particular issue?

I used to challenge this a lot back in time. I was building front end of airline company's website which they need to be valid by W3C and WCAG guidelines and validators. So i couldn't use custom attributes or anything that cause red flag on the validation.

This wonders me if that is the case, could we go with data-x-[directive]. Also I was thinking x- attribute should be configurable so devs can define their own selectors. Maybe something like data-alpine-config="{prefix: 'data-x'}" so with this, alpine directives will regionesed by data-x-[directive] prefix.

I think we can easily support an extended syntax data-x-* along the canonical one for those who need to stick with valid html5 syntax if Caleb is cool with that.
It will be just about adding an optional data- prefix to the regexps.

I agree with adding support for "data-x-" on top of "x-" (rather than config).

In a way I'm sure it could just be a "alpine-w3c-compliant" fork since the changes are likely to be very localised

I think we should hold off on this until it's a legitimate problem for people.

Not worth the work of no one actually needs it

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ryangjchandler picture ryangjchandler  路  3Comments

adinata-id picture adinata-id  路  4Comments

dkuku picture dkuku  路  5Comments

zaydek picture zaydek  路  3Comments

mrmathewc picture mrmathewc  路  4Comments