diff options
author | corvid <devnull@localhost> | 2015-01-24 08:50:23 +0000 |
---|---|---|
committer | corvid <devnull@localhost> | 2015-01-24 08:50:23 +0000 |
commit | fee4c8a195bff2c674491c5664dbb73c1d157d6b (patch) | |
tree | 46a243158f436a61093f143ff72692164edc268c /src | |
parent | f45b302df75f2442145a1ed464f9a308bae1540c (diff) |
html5 inside PRE don't complain about html4's pre.exclusion set
Diffstat (limited to 'src')
-rw-r--r-- | src/html.cc | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/src/html.cc b/src/html.cc index a7f3dccb..b7790d29 100644 --- a/src/html.cc +++ b/src/html.cc @@ -3087,20 +3087,23 @@ static void Html_tag_close_pre(DilloHtml *html) * Check whether a tag is in the "excluding" element set for PRE * Excl. Set = {IMG, OBJECT, APPLET, BIG, SMALL, SUB, SUP, FONT, BASEFONT} */ -static int Html_tag_pre_excludes(int tag_idx) -{ - const char *es_set[] = {"img", "object", "applet", "big", "small", "sub", - "sup", "font", "basefont", NULL}; - static int ei_set[10], i; - - /* initialize array */ - if (!ei_set[0]) - for (i = 0; es_set[i]; ++i) - ei_set[i] = a_Html_tag_index(es_set[i]); - - for (i = 0; ei_set[i]; ++i) - if (tag_idx == ei_set[i]) - return 1; +static int Html_tag_pre_excludes(DilloHtml *html, int tag_idx) +{ + if (!(html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f)) { + /* HTML5 doesn't say anything about excluding elements */ + const char *es_set[] = {"img", "object", "applet", "big", "small", "sub", + "sup", "font", "basefont", NULL}; + static int ei_set[10], i; + + /* initialize array */ + if (!ei_set[0]) + for (i = 0; es_set[i]; ++i) + ei_set[i] = a_Html_tag_index(es_set[i]); + + for (i = 0; ei_set[i]; ++i) + if (tag_idx == ei_set[i]) + return 1; + } return 0; } @@ -3950,7 +3953,7 @@ static void Html_process_tag(DilloHtml *html, char *tag, int tagsize) /* TODO: this is only raising a warning, take some defined action. * Note: apache uses IMG inside PRE (we could use its "alt"). */ - if ((html->InFlags & IN_PRE) && Html_tag_pre_excludes(ni)) + if ((html->InFlags & IN_PRE) && Html_tag_pre_excludes(html, ni)) BUG_MSG("<pre> is not allowed to contain <%s>.", Tags[ni].name); /* Make sure these elements don't nest each other */ |