Closed Bug 1492071 Opened 6 years ago Closed 6 years ago

[shadow dom] image in shadow root not reloading when src altered by javascript

Categories

(Core :: DOM: Core & HTML, defect)

63 Branch
defect
Not set
normal

Tracking

()

RESOLVED INVALID
Tracking Status
firefox62 --- unaffected
firefox63 --- affected
firefox64 --- affected

People

(Reporter: web, Assigned: emilio)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:62.0) Gecko/20100101 Firefox/62.0 Build ID: 20180830143136 Steps to reproduce: demo: https://road-physician.glitch.me code: https://glitch.com/edit/#!/road-physician?path=index.html:21:86 <lazy-image> uses IntersectionObserver to change the src attribute of an image element in its shadow root whenever the element is on screen. Actual results: The image attribute changes successfully when the element intersects, however, the loaded image does not appear on screen (i.e. the placeholder remains in place visually) This behaviour only occurs in developer edition version 63.0b6. Firefox 62 with web components flags enabled does not appear to have this problem. Expected results: when the image src attr changed, the image should have reloaded visually.
Hi, I can reproduce this on the latest Nightly 64 and Beta 63 builds. Setting the component in order to involve the development team in reviewing this issue. Thanks!
Status: UNCONFIRMED → NEW
Component: Untriaged → DOM
Ever confirmed: true
Product: Firefox → Core
Minimal testcase would be really nice.
I don't know what is supposed to happen with the testcase. Clicking launch shows some image on FF, another one on Chrome. On Chrome there is some weird flashing happening when loading the page.
Hmm, I see the img element in shadow DOM has the right src, but background-image is being shown.
Oh, <img> has opacity 0.
There are rules :host([fade]) img { opacity: 0; } img[intersecting] { opacity: 1; } and host element does have fade attribute.
Flags: needinfo?(emilio)
And img has intersecting
On demo page from description: Clicking the Launch button on Firefox 62 shows the image with a cat. Doing the same on Firefox 64 and 63, only the image placeholder is displayed. Chrome is showing the placeholder before the cat image is loaded, I guess that's the weird flashing you noticed.
The idea is to show the placeholder until the image is loaded, then fade to the image. If the css that handles the fade doesn't work the way I just described, that's my problem and not related to this issue. The issue here is that the image src attribute changes to the custom element's src attr, but the image displayed is the placeholder, not the new image.
And yes, 62 with dom.webcomponents.customelements.enabled=true and dom.webcomponents.shadowdom.enabled=true doesn't show the issue. <img> inside shadow DOM has opacity=1
looking.
Assignee: nobody → emilio
I think this is invalid. Bug 1454165 is what probably regressed this. But `:host([fade]) img` has greater specificity than `img[intersects]`. Blink accounts for specificity in ::slotted but not :host. The CSSWG resolved that they should in https://github.com/w3c/csswg-drafts/issues/1915. Closing as invalid for now. Though if more people are affected by this I guess we should revert bug 1454165. The change was proposed by Blink engineers as well so I hope they change Chrome to follow the spec: https://github.com/w3c/csswg-drafts/issues/1915#issuecomment-351658329.
Status: NEW → RESOLVED
Closed: 6 years ago
Flags: needinfo?(emilio)
Resolution: --- → INVALID
This indeed also fails on WebKit.
(Though I guess WebKit doesn't support IntersectionObserver).
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.