Comments

Dennis Cohn created an issue. See original summary.

dennis cohn’s picture

Issue summary: View changes
gausarts’s picture

Version: 8.x-2.1 » 8.x-2.x-dev

Thank you.

You are right.

> Why is this done?
Intriguing question. Shortly, somebody did :)
I accommodated requests from people who either need something not available, or are more knowledgeable than me.
That picture was in by request. I never worked with Picture:
#2752865: Support PICTURE element for the responsive image

My mistake, I didn't verify validity back then as I didn't need it as noted here:

I am going to close this as I am not planning to support Picture in the near future.
But I am open to patches if any.

This is the offending line:
https://git.drupalcode.org/project/blazy/commit/3874355#302a5e5435632d75...
$source->removeAttribute('srcset');

Feel free to patch for correction. Basically empty, not remove.

jastraat’s picture

Status: Active » Needs review
StatusFileSize
new514 bytes

Potential patch

rembrandx’s picture

StatusFileSize
new537 bytes

Sorry, but that last patch has a mistake in it. The srcset should be set with the value from data-srcset, NOT remove it.
Added a modified patch.
EDIT: I realize this patch probably 'breaks' the lazy load functionality (as in: it loads the sources right away) but it's the only way I could get sources to actually work. Empty srcset didn't get filled in by the JS in my project. So this on's just a dirty hack and not a real fix.

rembrandx’s picture

Finally found the root cause of the JS not working, so I remade the patch properly now.
the JS was looking at the parent of the picture element instead of picture itself when looking for the srcsets

Made 2 patches:
- 1 for version 2.1
- another patch based on the current 2.x branch

rembrandx’s picture

Issue summary: View changes
StatusFileSize
new906 bytes
rembrandx’s picture

Issue summary: View changes

Blazy doesn't seem to be working in Safari (or other browses that don't support native lazy loading).
I can't figure out where it's failing, so I made an extra patch with a quick fix that just bypasses everything and applies 'src'.
This means no lazy loading in Safari but at least images get loaded.

To do: find out the root cause and fix that instead

rembrandx’s picture

Issue summary: View changes
StatusFileSize
new1.29 KB

  • gausarts committed c80e2cb on 8.x-2.x authored by jastraat
    Issue #3167100 by rembrandx, jastraat, Dennis Cohn: Element “source” is...
gausarts’s picture

Status: Needs review » Fixed

@jastraat, thank you for the lead!

@rembrandx, we'd better set its value to empty as done by @jastraat. If the value is set (filled-in), it will defeat the lazyload purpose.
For the Safari issue, kindly create a new thread. Your fix is truly appreciated.
Regarding the bot message "Patch Failed to Apply", likely there is a change with the latest file. You might just need to sync your local files upstream.

@Dennis Cohn, thanks again for spotting on this mistake.

Committed. Thank you for contribution and amazing patience.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.