Skip to content

Commit 69ade7d

Browse files
committed
Fix attr def table to match enum
Error made when merging LOADING Is. htacg#879, PR htacg#902 And merging SLOT PR htacg#848 Also added a BIG warning over attribute_defs table to try to avoid this in future.
1 parent df8ff5c commit 69ade7d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/attrs.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ static AttrCheck CheckSvgAttr;
102102
#define CH_DECIMAL CheckDecimal
103103
#define CH_SVG CheckSvgAttr
104104

105+
/*
106+
WARNING: This table /must/ be kept in the EXACT order of the TidyAttrId enum!
107+
When running the DEBUG version, this order is checked, in TY_(InitAttrs)(doc),
108+
and there is an assert() if any difference found.
109+
*/
105110
static const Attribute attribute_defs [] =
106111
{
107112
{ TidyAttr_UNKNOWN, "unknown!", NULL },
@@ -183,7 +188,6 @@ static const Attribute attribute_defs [] =
183188
{ TidyAttr_LAST_VISIT, "last_visit", CH_PCDATA }, /* A */
184189
{ TidyAttr_LEFTMARGIN, "leftmargin", CH_NUMBER }, /* used on BODY */
185190
{ TidyAttr_LINK, "link", CH_COLOR }, /* BODY */
186-
{ TidyAttr_LOADING, "loading", CH_LOADING }, /* IMG, IFRAME */
187191
{ TidyAttr_LONGDESC, "longdesc", CH_URL }, /* IMG */
188192
{ TidyAttr_LOWSRC, "lowsrc", CH_URL }, /* IMG */
189193
{ TidyAttr_MARGINHEIGHT, "marginheight", CH_NUMBER }, /* FRAME, IFRAME, BODY */
@@ -245,7 +249,6 @@ static const Attribute attribute_defs [] =
245249
{ TidyAttr_SHOWGRIDX, "showgridx", CH_BOOL }, /* TABLE Adobe golive*/
246250
{ TidyAttr_SHOWGRIDY, "showgridy", CH_BOOL }, /* TABLE Adobe golive*/
247251
{ TidyAttr_SIZE, "size", CH_NUMBER }, /* HR, FONT, BASEFONT, SELECT */
248-
{ TidyAttr_SLOT, "slot", CH_PCDATA },
249252
{ TidyAttr_SPAN, "span", CH_NUMBER }, /* COL, COLGROUP */
250253
{ TidyAttr_SRC, "src", CH_URL }, /* IMG, FRAME, IFRAME */
251254
{ TidyAttr_SRCSET, "srcset", CH_PCDATA }, /* IMG (HTML5) */
@@ -447,6 +450,8 @@ static const Attribute attribute_defs [] =
447450

448451
/* for xmlns:xlink in <svg> */
449452
{ TidyAttr_XMLNSXLINK, "xmlns:xlink", CH_URL },
453+
{ TidyAttr_SLOT, "slot", CH_PCDATA },
454+
{ TidyAttr_LOADING, "loading", CH_LOADING }, /* IMG, IFRAME */
450455

451456
/* SVG paint attributes (SVG 1.1) */
452457
{ TidyAttr_FILL, "fill", CH_SVG },

0 commit comments

Comments
 (0)