Subject: Re: bug#49344: shr: Add support for "data-src" attribute in <img> nodes

From: Phil Sainty <[email-masked]>
Date: Sun, 04 Jul 2021 17:46:43 +1200

On 2021-07-03 12:56, 杨英超 wrote:
> https://www.geeksforgeeks.org/why-card-images-use-data-src-not-src-for-image-in-bootstrap-4/

The meaning of any 'data-*' attribute is 100% application-defined.
I don't think that any web browsers should be assuming that a
'data-src' attribute is actually a 'src' attribute (that's not
any kind of standard AFAIK), nor implement workarounds for specific
web sites that are not generating sane HTML.

The initial markup should have a proper 'src' attribute.  If the
site wants the initial state to be different in the presence of
Javascript, then it should be using Javascript to modify the
initial state accordingly, following a progressive-enhancement
approach.

As eww doesn't support Javascript, this particular case is only
one of many things which won't work when the site developers
make bad assumptions about Javascript.  I would expect your
example to fail in any web browser where JS was disabled or
not supported.

E.g. for me, using Firefox, the site looks very similar in
Firefox and eww because I use the uMatrix extension to only
permit Javascript to run on sites where I have explicitly
allowed it.  (Actually, the site looks *better* in eww, because
their code blocks in Firefox are barely readable on account
of the appallingly poor contrast between background and text.)

This is simply bad web design, and I don't think that's eww's
problem to solve.

-Phil