Reputation: 113
is there a XML or JSON resource I can parse in Javascript that tells me what HTML elements there are, what their attributes are and what CSS styles I can apply? I want to have a list of valid options without typing in everything by hand.
Please bear with me here, I'm new to this web stuff but have plenty experience in C (mostly game engines).
TIA!
Upvotes: 4
Views: 477
Reputation: 472
Sorry that this answer is almost six years too late for you. I was looking for the same thing and ended up writing my own tool for extracting some of the specs from the standard and exporting it as JSON
https://github.com/tawesoft/html5spec (self promotion disclaimer: I made this)
Hope that helps someone
Upvotes: 1
Reputation: 943510
(X)HTML before version 5 have DTDs that you can parse (you can get the URLs for them from the Doctype for the version of (X)HTML you are working with.
HTML 5 doesn't have an official machine readable spec. You might be able to extract something useful from the validator.nu source code though.
The CSS properties that can be applied to an element depend only on what other CSS properties have bee applied to it. Their only connection to HTML is that the browser's default stylesheet applies some properties automatically.
Upvotes: 2