-
Notifications
You must be signed in to change notification settings - Fork 24
Description
Currently, HTMLDocument is an instance of Element, which isn't actually true in the DOM (attribute and class-related functions are not on Document), but Element also contains some methods actually on Node, which are on Document (children, tree stuff, though actually these are on ParentNode). Furthermore, some things are actually on HTMLElement or HTMLDocument but not Element or Document. This makes it confusing to know where to put new methods.
Obviously this is a hard problem to solve, not only because different browsers implement these things slightly differently, but mostly because many of the types in the DOM are determined at run-time (especially HTML*, ParentNode).
Having type classes to represent these things is nice. Maybe there just need to be some more classes to represent Node, etc? This doesn't solve the runtime problem, though. Another option would be lots of newtypes, which could be dynamically cast up and down, but this doesn't solve the multiple-inheritance problem (though there's not too much of this).
I don't have a concrete suggestion, and do like how simple everything is now... Mainly looking for guidance for submitting more PRs. As mentioned on #4, a lot of this is just a naming problem -- maybe if there were just a system for parallel type class and concrete type naming (instance FooClass Foo)?