I'm curious about the possibility of having a .NET class library that provides a complete abstraction of HTML (and perhaps CSS styles as well).
There would be a .NET class for every kind of HTML element, and even abstract classes (e.g. an abstract base class 'List', which 'OrderedList' and 'UnorderedList' extend).
The elements could be then added to a tree structure and rendered into a complete HTML page, including styles, by recursively calling 'Render' or something similar on each element instance.
I can imagine many ways such a library could be useful:
Build into the framework awareness of cross-browser rendering issues, or even multiple device/screen-size support. It might then be possible to build a web page once, and have it work with all the major browsers right off the bat.
Build an HTML editor with extremely good IntelliSense, etc using reflection. The editor could also have a WYSIWIG mode that allows dynamic re-arranging of elements, without generating malformed markup.
Do some very powerful auditing on the website's SEO, compliance, accessibility, etc.
Perform very granular, intelligent caching, right down to the element level.
Has anything similar to this been thought of or attempted already?
(Note: I realize that ASP.NET has something similar to this, under its "HtmlControls" namespace, but it doesn't represent the full range of HTML elements, and the elements it does include aren't modeled accurately enough. Also, the HTML elements on ASP.NET webforms are treated like text-files and parsed at runtime, rather than being compiled as strongly-typed classes.)
(Another note: I think Google Web Toolkit bears some similarity to this idea, although it's written in Java, and aimed more at Ajax/Javascript/DOM, rather than standards-based XHTML, CSS and Javascript)