Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

DOM per se, as a tree of elements, is not that bad. CSS is also not that bad in general.

Their API is probably the problem. Not modular so makes the mess.

Options to modularize them:

DOM, concept of interfaces/behaviors rather than inheritance leading to huge maps. Let say for <textarea> we may have separate "textarea" interface:

   element.tagName
   ... and the rest of DOM-as-a-tree methods ...
   element.textarea // <textarea> specific interface of its behavior
   element.textarea.select(startEnd) // interface method
   element.textarea.selectionStart // interface prop
   element.textarea.selectionEnd // interface prop
   element.textarea.rows // interface prop
   element.textarea.columns // interface prop
   ...
CSS, that huge flat table is a nightmare, not just because of its size, but because of extensibility problems right now and in the future. Example, all CSS grid related properties should rather go to their own namespace:

   section {
     color: red;
     // ... and other basic CSS 2.1 props

     display: grid(
       rows: ...;
       columns: ...;
       align-items: center;
       justify-items: start
     );
   }
So different layouts ( like display:flex(), display:waterfall() ) may have their own rows, columns, etc.

As sooner we will do that - the better. API is on the brink of collapsing / combinatorial explosion, indeed.



Why does it matter? Its not like im doing a for..in loop over Element objects.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: