A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/whatwg/html/issues/2250 below:

Make underscore-prefixed attributes formally valid (works AS IS in all existing browsers) · Issue #2250 · whatwg/html · GitHub

It makes sense to make underscore-prefixed (_) custom HTML attributes formally valid:

<div _foo="bar" _lorem="ipsum" _boolean></div>
Facts and advantages The data- prefix is omitted/ignored in practice

The currently allowed data- prefix is in fact too long (5-times longer than _) and therefore just omitted/ignored in practice (e. g. the Angular JS library uses ng-* attributes), so HTML markup inevitably gets invalid anyway (and not future-proof compared with the underscore prefix).

No interrelation with data- and dataset

Underscore-prefixed attributes should not affect data- prefixed attributes and/or the dataset DOM property in any way, and vice versa. _ and data- prefixed attributes should just coexist.

Hyphen prefix as an option

Alternatively, hyphen (-) prefix could be used instead of underscore (_), but actually, both work in all browsers, both are future-proof, so both should be formally valid. Underscore would just be enough.

Also, from the two, the underscore prefix is reportedly the only XML-compatible option that is also confirmed by Simon Pieters (@zcorpan).

jhpratt, Marat-Tanalin, jonathantneal, calvinjuarez and vphantomrianby64, nuxodin and oliviarinat


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4