diff options
author | corvid <corvid@dillo.org> | 2013-09-05 19:44:45 +0000 |
---|---|---|
committer | corvid <corvid@dillo.org> | 2013-09-05 19:44:45 +0000 |
commit | c04f95a9a48c42bf65e5a4f1d524d34fa65c36f2 (patch) | |
tree | 583981b51333d9f80fd284cc1eea276b7d2b54f5 /src/html.cc | |
parent | d6f101c5cb2372965086ba5fc52fb324005d85e9 (diff) |
html5, id/name values are less restricted
Diffstat (limited to 'src/html.cc')
-rw-r--r-- | src/html.cc | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/html.cc b/src/html.cc index d695d56e..58c94f81 100644 --- a/src/html.cc +++ b/src/html.cc @@ -1511,17 +1511,27 @@ int32_t a_Html_color_parse(DilloHtml *html, const char *str, static int Html_check_name_val(DilloHtml *html, const char *val, const char *attrname) { - int i; + if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f) { + bool valid = *val && !strchr(val, ' '); - for (i = 0; val[i]; ++i) - if (!isascii(val[i]) || !(isalnum(val[i]) || strchr(":_.-", val[i]))) - break; + if (!valid) { + BUG_MSG("'%s' value must not be empty and must not contain spaces", + attrname); + } + return valid ? 1 : 0; + } else { + int i; - if (val[i] || !(isascii(val[0]) && isalpha(val[0]))) - BUG_MSG("'%s' value \"%s\" is not of the form " - "[A-Za-z][A-Za-z0-9:_.-]*\n", attrname, val); + for (i = 0; val[i]; ++i) + if (!isascii(val[i]) || !(isalnum(val[i]) || strchr(":_.-", val[i]))) + break; + + if (val[i] || !(isascii(val[0]) && isalpha(val[0]))) + BUG_MSG("'%s' value \"%s\" is not of the form " + "[A-Za-z][A-Za-z0-9:_.-]*\n", attrname, val); - return !(val[i]); + return !(val[i]); + } } /* |