Skip to content

feat: extend shadow DOM image replacements to include style.backgroundImage selectors#347

Merged
svrnm merged 2 commits into
feature/shadow-dom-supportfrom
copilot/sub-pr-344
Mar 17, 2026
Merged

feat: extend shadow DOM image replacements to include style.backgroundImage selectors#347
svrnm merged 2 commits into
feature/shadow-dom-supportfrom
copilot/sub-pr-344

Conversation

Copilot AI commented Mar 17, 2026

Copy link
Copy Markdown
Contributor

_applyOnShadowRoots only handled <img src> replacements, missing the two style.backgroundImage selectors that exist in the light DOM path for the image group.

Changes

  • src/models/Monkey.js — Added the two style.backgroundImage XPath selectors to _applyOnShadowRoots, scoped to the shadow root context node:
    • .//div[contains(@ad-test-id, "dash-image-widget-renderer")]
    • .//dash-kit-image-widget2/div/ui-kit-card-v1/div/div/div

The shadow DOM image group now mirrors the light DOM path exactly:

// Before
sum.image += this._applyOnXpathGroup(configuration, './/img', 'image', 'src', shadowRoot)

// After
sum.image += this._applyOnXpathGroup(configuration, './/img', 'image', 'src', shadowRoot)
sum.image += this._applyOnXpathGroup(
  configuration,
  './/div[contains(@ad-test-id, "dash-image-widget-renderer")]',
  'image',
  'style.backgroundImage',
  shadowRoot
)
sum.image += this._applyOnXpathGroup(
  configuration,
  './/dash-kit-image-widget2/div/ui-kit-card-v1/div/div/div',
  'image',
  'style.backgroundImage',
  shadowRoot
)

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: svrnm <1519757+svrnm@users.noreply.github.com>

Copilot AI commented Mar 17, 2026

Copy link
Copy Markdown
Contributor Author

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • example.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/DemoMonkey/DemoMonkey/node_modules/.bin/mocha --exclude=*/selenium/*.js --exclude=*/playwright/*.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] [WIP] Address feedback on shadow DOM support for replacements feat: extend shadow DOM image replacements to include style.backgroundImage selectors Mar 17, 2026
Copilot AI requested a review from svrnm March 17, 2026 18:59
@svrnm
svrnm marked this pull request as ready for review March 17, 2026 19:00
@svrnm
svrnm merged commit ad53552 into feature/shadow-dom-support Mar 17, 2026
1 check passed
@svrnm
svrnm deleted the copilot/sub-pr-344 branch March 17, 2026 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants