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

> You don’t need parent

You do need parent, check this: https://developer.mozilla.org/en-US/docs/Web/API/Node/parent...

> You want sibling nodes otherwise you will have to traverse back to the root node sometimes to find a sibling.

The only need for this is in Node.nextSibling implementation: https://developer.mozilla.org/en-US/docs/Web/API/Node/nextSi...

Where vector<>::find is pretty sufficient.

But in reality (at least in my Sciter) node stores its index in parent's m_children so it is O(1) operation.



Is there source code available online illustrating your more-efficient DOM data-structure ?


How about the + operator in CSS?


And what is wrong with it?

and ~ combinator and :nth-child(n) selector for that matter too.


I'm responding to the claim that you only need the ability to find a sibling for the nextSibling method.




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: