',
@@ -278,70 +285,223 @@ def test_cdata_content(self):
'src="http://www.example.org/r=\'+new '
'Date().getTime()+\'"><\\/s\'+\'cript>\');\n//]]>'),
'\n\n',
- 'foo = "";',
'',
- # these two should be invalid according to the HTML 5 spec,
- # section 8.1.2.2
- #'foo = \nscript>',
- #'foo = script>',
- ]
- elements = ['script', 'style', 'SCRIPT', 'STYLE', 'Script', 'Style']
- for content in contents:
- for element in elements:
- element_lower = element.lower()
- s = '<{element}>{content}{element}>'.format(element=element,
- content=content)
- self._run_check(s, [("starttag", element_lower, []),
- ("data", content),
- ("endtag", element_lower)])
-
- def test_cdata_with_closing_tags(self):
+ 'foo = " script>"',
+ 'foo = ""',
+ 'foo = ""',
+ 'foo = ""',
+ 'foo = "ſcript>"',
+ 'foo = ""',
+ ])
+ def test_script_content(self, content):
+ s = f''
+ self._run_check(s, [("starttag", "script", []),
+ ("data", content),
+ ("endtag", "script")])
+
+ @support.subTests('content', [
+ 'a::before { content: ""; }',
+ 'a::before { content: "¬-an-entity-ref;"; }',
+ 'a::before { content: "
''""" - for element in [' script', 'script ', ' script ', - '\nscript', 'script\n', '\nscript\n']: - element_lower = element.lower().strip() - s = ''""" - s = f'', True), + ]) + def test_eof_in_script(self, tail, end): + content = "a = 123" + s = f'