5 ms·
I can see why collapsible sub-trees aren't quite dead-simple. The comment list is a single table, and each comment is a separate row. There's no container aroun
by DougWebb 11y ago
I can see why collapsible sub-trees aren't quite dead-simple. The comment list is a single table, and each comment is a separate row. There's no container around a comment's children. (Also, the indenting is implemented by putting a 1x1 image in the first column and setting its width based on the indent depth required.)
Internally, there's obviously tracking of parent/child relationships, but adding container elements so that the children can be hidden would require getting rid of the table-based layout and replacing it with a nested div-based layout. The markup and styling changes would be fairly simple, but none of us know what the impact is on the backend, or on anything that depends on the markup structure that may or may not be in HN's control. My guess is that these non-technical impacts are the driving force behind keeping the markup as it is, which prevents the kind of features you want.
- pas 11y agoFind the row clicked on. Find the indent. For every row that has larger indent (until one with the same indent), set display: none. For this row, mark it collapsed (even by putting a div around the current content, un-displaying it and putting a "show thread" button/link there). So indent is width of the "invisible pixel", easy to query, isn't it? What am I missing?