Is. #879: add loading attribute for img, iframe (#902)

Closes #879
This commit is contained in:
Sid Vishnoi 2020-11-21 22:33:20 +05:30 committed by GitHub
parent d6cd2538e9
commit e5ef43f6c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 0 deletions

View file

@ -1083,6 +1083,7 @@ typedef enum
TidyAttr_LAST_VISIT, /**< LAST_VISIT= */
TidyAttr_LEFTMARGIN, /**< LEFTMARGIN= */
TidyAttr_LINK, /**< LINK= */
TidyAttr_LOADING, /**< LOADING= */
TidyAttr_LONGDESC, /**< LONGDESC= */
TidyAttr_LOWSRC, /**< LOWSRC= */
TidyAttr_MARGINHEIGHT, /**< MARGINHEIGHT= */

View file

@ -1631,6 +1631,7 @@ const AttrVersion TY_(W3CAttrsFor_IFRAME)[] =
{ TidyAttr_FRAMEBORDER, xxxx|xxxx|H40T|H41T|X10T|H40F|H41F|X10F|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx },
{ TidyAttr_HEIGHT, xxxx|xxxx|H40T|H41T|X10T|H40F|H41F|X10F|xxxx|xxxx|xxxx|xxxx|xxxx|HT50|XH50 },
{ TidyAttr_ID, xxxx|xxxx|H40T|H41T|X10T|H40F|H41F|X10F|xxxx|xxxx|xxxx|xxxx|xxxx|HT50|XH50 }, /* CORE override */
{ TidyAttr_LOADING, xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|HT50|XH50 },
{ TidyAttr_LONGDESC, xxxx|xxxx|H40T|H41T|X10T|H40F|H41F|X10F|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx },
{ TidyAttr_MARGINHEIGHT, xxxx|xxxx|H40T|H41T|X10T|H40F|H41F|X10F|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx },
{ TidyAttr_MARGINWIDTH, xxxx|xxxx|H40T|H41T|X10T|H40F|H41F|X10F|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx },
@ -1664,6 +1665,7 @@ const AttrVersion TY_(W3CAttrsFor_IMG)[] =
{ TidyAttr_ID, xxxx|xxxx|H40T|H41T|X10T|H40F|H41F|X10F|H40S|H41S|X10S|XH11|XB10|HT50|XH50 }, /* CORE override */
{ TidyAttr_ISMAP, HT20|HT32|H40T|H41T|X10T|H40F|H41F|X10F|H40S|H41S|X10S|XH11|xxxx|HT50|XH50 },
{ TidyAttr_LANG, xxxx|xxxx|H40T|H41T|X10T|H40F|H41F|X10F|H40S|H41S|X10S|xxxx|xxxx|HT50|XH50 }, /* CORE override */
{ TidyAttr_LOADING, xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|HT50|XH50 },
{ TidyAttr_LONGDESC, xxxx|xxxx|H40T|H41T|X10T|H40F|H41F|X10F|H40S|H41S|X10S|XH11|XB10|xxxx|xxxx },
{ TidyAttr_NAME, xxxx|xxxx|xxxx|H41T|X10T|xxxx|H41F|X10F|xxxx|H41S|xxxx|xxxx|xxxx|xxxx|xxxx },
{ TidyAttr_OnCLICK, xxxx|xxxx|H40T|H41T|X10T|H40F|H41F|X10F|H40S|H41S|X10S|XH11|xxxx|HT50|XH50 }, /* CORE override */

View file

@ -47,6 +47,7 @@ static AttrCheck CheckVType;
static AttrCheck CheckScroll;
static AttrCheck CheckTextDir;
static AttrCheck CheckLang;
static AttrCheck CheckLoading;
static AttrCheck CheckType;
static AttrCheck CheckRDFaSafeCURIE;
static AttrCheck CheckRDFaTerm;
@ -66,6 +67,7 @@ static AttrCheck CheckRDFaPrefix;
#define CH_CLEAR CheckClear
#define CH_BORDER CheckBool /* kludge */
#define CH_LANG CheckLang
#define CH_LOADING CheckLoading
#define CH_BOOL CheckBool
#define CH_COLS NULL
#define CH_NUMBER CheckNumber
@ -177,6 +179,7 @@ static const Attribute attribute_defs [] =
{ TidyAttr_LAST_VISIT, "last_visit", CH_PCDATA }, /* A */
{ TidyAttr_LEFTMARGIN, "leftmargin", CH_NUMBER }, /* used on BODY */
{ TidyAttr_LINK, "link", CH_COLOR }, /* BODY */
{ TidyAttr_LOADING, "loading", CH_LOADING }, /* IMG, IFRAME */
{ TidyAttr_LONGDESC, "longdesc", CH_URL }, /* IMG */
{ TidyAttr_LOWSRC, "lowsrc", CH_URL }, /* IMG */
{ TidyAttr_MARGINHEIGHT, "marginheight", CH_NUMBER }, /* FRAME, IFRAME, BODY */
@ -2046,6 +2049,13 @@ void CheckLang( TidyDocImpl* doc, Node *node, AttVal *attval)
}
}
/* checks loading attribute */
void CheckLoading( TidyDocImpl* doc, Node *node, AttVal *attval)
{
ctmbstr const values[] = {"lazy", "eager", NULL};
CheckAttrValidity( doc, node, attval, values );
}
/* checks type attribute */
void CheckType( TidyDocImpl* doc, Node *node, AttVal *attval)
{