Skip to content
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

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

Merged
merged 1 commit into from
Nov 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/tidyenum.h
Original file line number Diff line number Diff line change
Expand Up @@ -1082,6 +1082,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= */
Expand Down
2 changes: 2 additions & 0 deletions src/attrdict.c
Original file line number Diff line number Diff line change
Expand Up @@ -1630,6 +1630,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 },
Expand Down Expand Up @@ -1663,6 +1664,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 */
Expand Down
10 changes: 10 additions & 0 deletions src/attrs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -2045,6 +2048,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)
{
Expand Down