oddbird/css-anchor-positioning

`elements` option should find inline styles on descendent elements

開放

#289 建立於 2025年1月15日

 (0 則留言) (3 個反應) (0 位負責人)TypeScript (18 個分叉)auto 404
enhancementgood first issue

倉庫指標

星標
 (489 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

Is your feature request related to how this polyfill works? Please describe.

Given this HTML

<div id="wrapper">
  <div id="anchor" style="anchor-name: --a">A</div>
  <div id="target" style="position-anchor: --a">A</div>
</div>

and calling:

polyfill({elements: [wrapper], excludeInlineStyles: true})

Inline styles on #anchor and #target are not polyfilled. It would be useful to not have to pass each individual element, but instead just the wrapper.

Describe the solution you'd like

Adjust the polyfill so that if an element is passed, it AND its entire subtree are evaluated for inline anchor styles.

Describe alternatives you've considered

We could make this opt in, perhaps with a includeChildInlineStyles or an alternate to elements, but I think it's unlikely that people will want to not polyfill children.

Additional context Codepen Repro

貢獻者指南