w3c / adapt

Semantics to describe user personalization preferences.
https://w3c.github.io/adapt/
Other
51 stars 27 forks source link

Usage of adapt-* attributes in HTTP Archive #222

Open zcorpan opened 1 year ago

zcorpan commented 1 year ago

At the APA & WHATWG joint meeting at TPAC today we discussed the usage of data-* attributes. The reason for not using data-* is that those attributes are intended store information that is private to the page. The HTML standard says:

Custom data attributes are intended to store custom data, state, annotations, and similar, private to the page or application, for which there are no more appropriate attributes or elements.

These attributes are not intended for use by software that is not known to the administrators of the site that uses the attributes. For generic extensions that are to be used by multiple independent tools, either this specification should be extended to provide the feature explicitly, or a technology like microdata should be used (with a standardized vocabulary).

There seemed to be a preference in the meeting for the adapt- prefix. I promised to research usage in HTTP Archive for such attributes, which I've now done. I also looked for ssml- while at it.

The result is that out of the 15,000,000 pages in the dataset, there are 19 pages which use an attribute adapt-container-width="true". There were no ssml- prefixed attributes.

Conclusion: it should be web compatible to use adapt- and ssml- as prefixes.

query and detailed result ``` SELECT * FROM ( SELECT page, ARRAY_TO_STRING(REGEXP_EXTRACT_ALL(body, r'(?i)(<[a-z][a-z0-9_-]*(?:\s+[^>]+)*\s+(?:adapt|ssml)-[a-z0-9_-]*[^>]*>)'), "\n") AS match FROM `httparchive.response_bodies.2022_08_01_mobile` WHERE page = url ) WHERE match != "" ``` Result: https://docs.google.com/spreadsheets/d/1cFW6vGH5u3qgFyP2a3AvNkDCkKobWlhc_lI6_djCYkY/edit?usp=sharing Note that the results contain false positives with e.g. `adapt-*` in `class=""`.
zcorpan commented 1 year ago

Someone asked in the meeting if there's a list of all prefixed attributes that exist, which I had actually researched a few years ago: https://github.com/whatwg/html/issues/2271#issuecomment-273716582

matatk commented 1 year ago

Thank you @zcorpan for researching this and letting us know; this is great news. I am sure the Adapt Task Force will be filing an issue over on the HTML repo in order to begin dialogue with the WHATWG in due course.

I think that may've been me asking the question about the list of prefixed attributes. I'm also quite interested in searching the archive as part of our further development of the Adapt spec, and in relation to a separate personal project relating to landmark regions, so thanks for the pointers to those results, the docs, and the queries you used.

snidersd commented 1 year ago

As per our discussion in today's Adapt weekly call, I'm adding the link to the filed issue requesting adapt- as our new prefix - https://github.com/whatwg/html/issues/9084.