09:26
<weeb69>
Hi, is there a machine readable list of all the HTML elements, their attributes, etc? If so, where can I find it? Context: I'm looking to build a strongly-typed HTML DSL
09:26
<weeb69>
(please ping me when responding)
09:28
<sideshowbarker>
weeb69: https://github.com/validator/validator/tree/main/schema/html5
09:29
<weeb69>
weeb69: https://github.com/validator/validator/tree/main/schema/html5
is there a readme or anything i can look at to know to how to parse this?
09:31
<sideshowbarker>
it’s a relaxng schema
09:31
<sideshowbarker>
the entry points are in https://github.com/validator/validator/blob/main/schema/.drivers/
09:31
<sideshowbarker>
e.g., https://github.com/validator/validator/blob/main/schema/.drivers/html5-all.rnc
09:33
<sideshowbarker>
but it’s meant to be used with two inputs: 1) that grammar, and 2) an instance against which to validate, using that grammar
09:33
<sideshowbarker>
https://github.com/relaxng/jing-trang is the tool for working with it
09:35
<sideshowbarker>
but it would be a lot of work to repurpose that grammar for something other than validation
09:35
<weeb69>
I need to convert that information to Rust types. I can't find any documentation on how the information is laied out (which files contains what)
09:36
<weeb69>
Right now, my best bet seems to be to scrape MDN docs and put in some manual work
09:36
<sideshowbarker>
however, I’m not aware of any other machine-readable expressions of HTML that conform to the current spec
09:36
<Luca Casonato>
The WebIDL?
09:36
<Ms2ger>
The syntax?
09:37
<weeb69>
does the WebIDL contain information about HTML elements?
09:37
<sideshowbarker>
yes
09:38
<Ms2ger>
Only sort of
09:38
<sideshowbarker>
but WebIDL expresses the DOM interface and DOM attributes, not the content/markup attributes
09:38
<Luca Casonato>
does the WebIDL contain information about HTML elements?
The JS APIs corresponding to all html elements
09:38
<sideshowbarker>
and there is not 1-to-1 WebIDL for every element
09:38
<Ms2ger>
There's also https://html.spec.whatwg.org/multipage/indices.html#elements-3
09:39
<sideshowbarker>
ah yeah that would be parseable
09:41
<weeb69>
There's also https://html.spec.whatwg.org/multipage/indices.html#elements-3
I have a feeling parsing that would be more work than parsing the MDN page
09:41
<weeb69>
https://developer.mozilla.org/en-US/docs/Web/HTML/Element and https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
09:41
<weeb69>
ones
09:44
<weeb69>
https://github.com/mdn/content/tree/main/files/en-us/web/html
09:44
<weeb69>
this seems like a nice representation
09:45
<weeb69>
i could use just the directory structure to get the data
12:41
<freddy>
It seems this all depends on how bad an inaccuracy here would be for your desired outcome.. :)
17:34
<tabatkins>
Hm, it's not possible to set an ObservableArray attribute directly to an array (having it replace all the members), is it? @domenic?
17:34
<tabatkins>
If not, I can raise an issue for it.
17:46
<hsivonen>
Do I understand correctly that WebKit and Blink use the full HTML tokenizer for meta prescan but don't use the real tree builder for figuring out which tokens would imply <body>?
17:48
<Domenic>
Hm, it's not possible to set an ObservableArray attribute directly to an array (having it replace all the members), is it? @domenic?
It is possible; see https://heycam.github.io/webidl/#ref-for-dfn-observable-array-type%E2%91%A3
18:08
<tabatkins>
Oh dang, that's nice. I'll still probably submit a PR to add an example of this to the description, as it's not clear from anywhere outside that algo that this is possible.
19:57
<Domenic>
Well, there's also https://heycam.github.io/webidl/#:~:text=building.employees%20%3D%20%5Bnew%20Employee(%22D%22)%2C%20employeeB%2C%20new%20Employee(%22C%22)%5D%3B
20:22
<tabatkins>
Oh huh, I skipped right over that.
20:22
<tabatkins>
I was actively reading that and the next chunk of example code.