Elements can be marked as being in a shadow tree and at the same time containingShadowRoot can be null (for example when removing/disconnecting elements), so null check containingShadowRoot in more places.
Created attachment 463247 [details] Patch
Committed 256005@main (bc488196fd2d): <https://commits.webkit.org/256005@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 463247 [details].
<rdar://problem/101583435>