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

Walking the DOM is a problem because if (or when) its structure changes, everything breaks.

Also, "astonishingly prevalent"? Come on!



Then your code is too tightly coupled to an instance without you writing error handling or any kind of fallback. That kind of fragility is not limited to the DOM and can occur in any programming.


This is not a problem that can be fixed by error handling. It's just best avoided if an application developer is altering the DOM at will. The DOM is not a good, stable API.


Yes, it’s tight coupling and it can be fixed by writing better code. The DOM API has maintained full backwards compatibility for its 25 year history of massive evolution so it’s extremely stable. That stability is completely orthogonal to the incompetence of the developer using it though.

My daughter doesn’t like driving my manual transmission car and cannot figure it out. That doesn’t mean my car has an unstable API. She does mention the same sort of bullshit about blaming the technology for her own incompetence though.


I'm not talking about the DOM API. I'm talking about writing code that relies on a certain DOM structure - i.e. misusing that structure as an API format when it wasn't intended for that, and any changes made to it would not bear that in mind.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: