Skip to content

feature: Support data-src and data-srcset for img - #5

Merged
mitchcapper merged 1 commit into
masterfrom
pr_220
Jul 27, 2022
Merged

mitchcapper merged 1 commit into
masterfrom
pr_220

Conversation

@mitchcapper

Copy link
Copy Markdown
Owner

Increasingly HTML5 sites use a number of mechanisms for responsive
image loading.  Many of these mechanisms revolve around the use of
`data-src` and `data-srcset` attributes within an img tag to provide a
list of valid images to display, along with their relevant sizes (e.g.
https://github.com/aFarkas/lazysizes, https://github.com/malchata/yall.js
).

This change adds the two previously mentioned tags to the list in
`hts_detect[]`, resulting in httrack detecting them correctly.

Initially an attempt was made at using `hts_detectbeg[]` with the
potential of resolving xroche#203.  Unfortunately it became apparent that the
implementation of `hts_detectbeg[]` only supports a suffix of integers
(see `src/htstools.h#rech_tageqbegdigits` for more information).
@mitchcapper
mitchcapper merged commit 355d21d into master Jul 27, 2022
@marcstern

marcstern commented Mar 1, 2023

Copy link
Copy Markdown

Same problem with srcset:
<img decoding="async" loading="lazy" src="images/pentest-report-download-image-01-209x300.png" alt="" class="wp-image-109" width="270" height="387" srcset="https://xxx/wp-content/uploads/2022/09/Pentest-Report-Download-Image-01-209x300.png 209w, https://xxx/wp-content/uploads/2022/09/Pentest-Report-Download-Image-01-715x1024.png 715w" sizes="(max-width: 270px) 100vw, 270px" />

I added "srcset" the same way but it doesn't seem suffisant. Did I miss something?
I guess we should add it anyway (and potentially fix the parser if needed).

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.

3 participants