3 ms·
In addition to what the other commenters said: HTML/DOM is a presentation-oriented document model. It's the "V" in MVC. It only works as the data model for some
by lobster_johnson 10y ago
In addition to what the other commenters said: HTML/DOM is a presentation-oriented document model. It's the "V" in MVC. It only works as the data model for something that is analogous to HTML.
In particular, the moment you have content (data) that doesn't map 1:1 to DOM, you have an issue. For example, imagine I want to embed a "photo object". It's not just an image; it also renders the photo credit/copyright underneath. But that makes it a composite; internally, it's a photo ID, the dimensions, maybe some cropping info, plus the crediting metadata. So the internal data node no longer maps directly to the DOM. Internally, you want a single node, but in the DOM it would have to be multiple when rendered.
Same goes for other composite embeds like videos, maps, forms, tables and so on.
Editors are classic MVC: Regardless of whether the view is HTML, Cocoa, Qt, whatever the Windows UI API is these days -- you need to keep model decoupled from it.