Skip to content

Commit e5ef43f

Browse files
authored
Is. #879: add loading attribute for img, iframe (#902)
Closes #879
1 parent d6cd253 commit e5ef43f

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

include/tidyenum.h

+1
Original file line numberDiff line numberDiff line change
@@ -1083,6 +1083,7 @@ typedef enum
10831083
TidyAttr_LAST_VISIT, /**< LAST_VISIT= */
10841084
TidyAttr_LEFTMARGIN, /**< LEFTMARGIN= */
10851085
TidyAttr_LINK, /**< LINK= */
1086+
TidyAttr_LOADING, /**< LOADING= */
10861087
TidyAttr_LONGDESC, /**< LONGDESC= */
10871088
TidyAttr_LOWSRC, /**< LOWSRC= */
10881089
TidyAttr_MARGINHEIGHT, /**< MARGINHEIGHT= */

src/attrdict.c

+2
Original file line numberDiff line numberDiff line change
@@ -1631,6 +1631,7 @@ const AttrVersion TY_(W3CAttrsFor_IFRAME)[] =
16311631
{ TidyAttr_FRAMEBORDER, xxxx|xxxx|H40T|H41T|X10T|H40F|H41F|X10F|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx },
16321632
{ TidyAttr_HEIGHT, xxxx|xxxx|H40T|H41T|X10T|H40F|H41F|X10F|xxxx|xxxx|xxxx|xxxx|xxxx|HT50|XH50 },
16331633
{ TidyAttr_ID, xxxx|xxxx|H40T|H41T|X10T|H40F|H41F|X10F|xxxx|xxxx|xxxx|xxxx|xxxx|HT50|XH50 }, /* CORE override */
1634+
{ TidyAttr_LOADING, xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|HT50|XH50 },
16341635
{ TidyAttr_LONGDESC, xxxx|xxxx|H40T|H41T|X10T|H40F|H41F|X10F|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx },
16351636
{ TidyAttr_MARGINHEIGHT, xxxx|xxxx|H40T|H41T|X10T|H40F|H41F|X10F|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx },
16361637
{ 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)[] =
16641665
{ TidyAttr_ID, xxxx|xxxx|H40T|H41T|X10T|H40F|H41F|X10F|H40S|H41S|X10S|XH11|XB10|HT50|XH50 }, /* CORE override */
16651666
{ TidyAttr_ISMAP, HT20|HT32|H40T|H41T|X10T|H40F|H41F|X10F|H40S|H41S|X10S|XH11|xxxx|HT50|XH50 },
16661667
{ TidyAttr_LANG, xxxx|xxxx|H40T|H41T|X10T|H40F|H41F|X10F|H40S|H41S|X10S|xxxx|xxxx|HT50|XH50 }, /* CORE override */
1668+
{ TidyAttr_LOADING, xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|HT50|XH50 },
16671669
{ TidyAttr_LONGDESC, xxxx|xxxx|H40T|H41T|X10T|H40F|H41F|X10F|H40S|H41S|X10S|XH11|XB10|xxxx|xxxx },
16681670
{ TidyAttr_NAME, xxxx|xxxx|xxxx|H41T|X10T|xxxx|H41F|X10F|xxxx|H41S|xxxx|xxxx|xxxx|xxxx|xxxx },
16691671
{ TidyAttr_OnCLICK, xxxx|xxxx|H40T|H41T|X10T|H40F|H41F|X10F|H40S|H41S|X10S|XH11|xxxx|HT50|XH50 }, /* CORE override */

src/attrs.c

+10
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ static AttrCheck CheckVType;
4747
static AttrCheck CheckScroll;
4848
static AttrCheck CheckTextDir;
4949
static AttrCheck CheckLang;
50+
static AttrCheck CheckLoading;
5051
static AttrCheck CheckType;
5152
static AttrCheck CheckRDFaSafeCURIE;
5253
static AttrCheck CheckRDFaTerm;
@@ -66,6 +67,7 @@ static AttrCheck CheckRDFaPrefix;
6667
#define CH_CLEAR CheckClear
6768
#define CH_BORDER CheckBool /* kludge */
6869
#define CH_LANG CheckLang
70+
#define CH_LOADING CheckLoading
6971
#define CH_BOOL CheckBool
7072
#define CH_COLS NULL
7173
#define CH_NUMBER CheckNumber
@@ -177,6 +179,7 @@ static const Attribute attribute_defs [] =
177179
{ TidyAttr_LAST_VISIT, "last_visit", CH_PCDATA }, /* A */
178180
{ TidyAttr_LEFTMARGIN, "leftmargin", CH_NUMBER }, /* used on BODY */
179181
{ TidyAttr_LINK, "link", CH_COLOR }, /* BODY */
182+
{ TidyAttr_LOADING, "loading", CH_LOADING }, /* IMG, IFRAME */
180183
{ TidyAttr_LONGDESC, "longdesc", CH_URL }, /* IMG */
181184
{ TidyAttr_LOWSRC, "lowsrc", CH_URL }, /* IMG */
182185
{ TidyAttr_MARGINHEIGHT, "marginheight", CH_NUMBER }, /* FRAME, IFRAME, BODY */
@@ -2046,6 +2049,13 @@ void CheckLang( TidyDocImpl* doc, Node *node, AttVal *attval)
20462049
}
20472050
}
20482051

2052+
/* checks loading attribute */
2053+
void CheckLoading( TidyDocImpl* doc, Node *node, AttVal *attval)
2054+
{
2055+
ctmbstr const values[] = {"lazy", "eager", NULL};
2056+
CheckAttrValidity( doc, node, attval, values );
2057+
}
2058+
20492059
/* checks type attribute */
20502060
void CheckType( TidyDocImpl* doc, Node *node, AttVal *attval)
20512061
{

0 commit comments

Comments
 (0)