Allow "on" attributes that have a dash (bug 981221)

This commit is contained in:
Mark Striemer 2014-06-19 14:19:58 -05:00
Родитель be5bf89c32
Коммит f24da163f2
2 изменённых файлов: 10 добавлений и 1 удалений

Просмотреть файл

@ -167,8 +167,9 @@ class MarkupParser(HTMLParser):
csstester.test_css_snippet(
self.err, self.filename, attr_dict["style"], self.line)
event_attribute = lambda k: k.startswith("on") and "-" not in k
script_attributes = dict(
(k, v) for k, v in attr_dict.iteritems() if k.startswith("on"))
(k, v) for k, v in attr_dict.iteritems() if event_attribute(k))
if script_attributes:
if any(k in DOM_MUTATION_HANDLERS for k in script_attributes):
self.err.error(

Просмотреть файл

@ -181,6 +181,14 @@ def test_script_attrs():
""", "foo.xul", should_fail_csp=True)
def test_script_like_attrs():
"""Test that attributes like on-click are okay."""
_test_xul_raw("""<foo><bar on-zap="asdf" /></foo>""",
"foo.xul",
should_fail_csp=False)
def test_dom_mutation():
"""Test that DOM mutation events are warned against. This should fail both
the standard tests as well as the CSP tests."""