-
Notifications
You must be signed in to change notification settings - Fork 418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optionally warn about missing <img width= height=> #757
Comments
@jidanni not a difficult feature request... There is already a It would be easy to add no But really wonder about the There was a time, not so long ago, that good web content developers would take the trouble to provide a correctly sized source, maybe with a link to the full for separate viewing/download... and would guess that would still apply if faster page loading was the important criteria... where such a warning would not be needed... even be wrong, or at least very annoying... Now you are suggesting they have become so lazy, time stressed, whatever... that they would And I do not think adding size attributes, that adds an additional transformation to the process, would actually make the page load faster, but maybe, if say the video card/driver/display handling is a big component of the load time... but such a machine would certainly be better helped by supplying sized images... But if someone were to take the trouble to code this, add patches, PR, then I suppose it could be considered... given a What do others think... thanks... |
Just like when we are browsing with images purposely turned off,
or ad blockers are removing images, readers still would like to know
how the page was structured. So height and width are as important as
"alt=". Readers need to know there was a big image there vs. a tiny
1x1 image there.
|
@jidanni thanks for the feedback, but it seems you have not yet fully specified this
While that might be accepted as true, and tidy does try to be Or are you adding that even if present, this option would Some pseudo code, untested, just thoughts, on how it might look - void CheckIMG( TidyDocImpl* doc, Node *node ) {
/* some new option, like 'check-img-sizes', 'show-img-sizes', or ... */
if (nodeIsIMG(node) && cfg(doc, TidyChkImgSizes))
{
AttVal *ph = TY_(AttrGetById)(node, TidyAttr_HEIGHT);
AttVal *pw = TY_(AttrGetById)(node, TidyAttr_WIDTH);
if (!ph || !pw)
{
/* Is #757 - img: report a missing size attrib -
could separate to which one, or both...
details missing in 'spec' */
printf("Info:Warning:Error: img tag missing height and/or width attribute...\n");
}
else
{
/* is anything to be done in this case? */
printf("[type?]: img tag has width=%s, and height=%s...\n", pw, ph );
}
} Have marked it a Need someone to document the full option specs, discuss, agree, code it, and present patches, PR, and then, as stated, hopefully with more Look forward to more... thanks... |
I read about that a long time ago; it might even still be relevant/true :) Specifying the image size allows the page render process to leave a "hole" where the image goes. Then when the image is downloaded the browser just plops it into the correct place & it's done. If the image tag doesn't have a height/width attribute the browser has to wait until the image is downloaded to figure out how much room the image takes up in the page. So the browser either stalls until it gets the image or keeps going with displaying the page until the image is downloaded and re-draws the page again (re-flow in firefox?) with the new image size info. |
@geoffmcl I don't think tidy is a dead link checker, or should look for image files and tell the user the size to put in. I just want in to tell me, in addition that I should add an "alt=", I would optionally usually want to know that I forgot width= and/or height=. (And no, no AI needed to tell me what the alt= should say :-) ) And yes saying "missing ... and/or ..." is good enough, as if the user just forgot one of width or height, he already needs more help than tidy can provide :-) |
Tidy should optionally warn if one forgets to put the width and height
attributes on tags. Warning about missing alt= is good, but
people also like their pages to load faster...
No none of the -access checks catch it either, (which makes sense.)
Tidy 5.2 (newest :-( ) on Debian.
The text was updated successfully, but these errors were encountered: