Created attachment 467431 [details] Repro screenshot of Chrome, Firefox, and Safari Technology Preview The `adoptedStyleSheets` ObservableArray should have a `length` property that is writable. (This is consistent with how regular JavaScript arrays work.) However, in Safari Technology Preview (Safari 17.0, WebKit 18617.1.4.3), the `length` property is non-writable, and writing to it does not affect the underlying array. Minimal repro: const sheet = new CSSStyleSheet() sheet.replaceSync('div { color: red }') document.adoptedStyleSheets.push(sheet) document.adoptedStyleSheets.length = 0 // this should empty the array In the attached screenshot, you can see that this leads to an observable difference between Chrome and Firefox (text is black) vs Safari Technology Preview (text is red). Here is a CodePen repro [1]. Additionally, the `writable` property on the property descriptor returns `false` in Safari but `true` in Chrome and Firefox. (Repro: [2]) Object.getOwnPropertyDescriptor(document.adoptedStyleSheets, 'length').writable In the spec [3], there is an explicit example [4] of setting `length` to 0 to demonstrate that the array is mutable. [1]: https://codepen.io/nolanlawson-the-selector/pen/bGOVLre [2]: https://codepen.io/nolanlawson-the-selector/pen/rNoOJyp?editors=1010 [3]: https://webidl.spec.whatwg.org/#idl-observable-array [4]: https://webidl.spec.whatwg.org/#example-observable-array
Created attachment 467432 [details] Minimal repro HTML
Thank you for the report! This reproduces with Safari 16.5.1 too, so not a recent regression.
Maybe depends on Bug 238281
<rdar://problem/114822538>
Pull request: https://github.com/WebKit/WebKit/pull/17350
Committed 267594@main (8e072e6f9bed): <https://commits.webkit.org/267594@main> Reviewed commits have been landed. Closing PR #17350 and removing active labels.