Hacker News new | ask | show | jobs
by myfonj 1764 days ago
As for why the parent render tree invalidation is necessary, consider

    <style>
      main:only-child * { /* ... */ }
    </style>
    <body>
      <main>lots of stuff </main>
    </body>
When second node is appended to <body> our CSS selector no longer matches so the rule stops being applied and content of the <main> is no longer styled.

When there is (next) sibling wrapper present, anything what happens inside it cannot affect the <main> in our example: in CSS there simply is currently no way to target element according it's next sibling inner structure. (There is one for previous sibling: `prev:empty + next {}`: when prev stops being empty, rule stops to match.)