html5lib / gcode-import

Automatically exported from code.google.com/p/html5lib. Purely archival.
Other
7 stars 8 forks source link

Don't support Javascript in select tag #158

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. it based on html5lib 0.11.1
2. write a test html

<html>
<body>

<select name="CISOOP2" title="Search options.">
<script language="JavaScript" type="text/javascript">
<!--
for(k=0;k<3;k++){
document.writeln('<option value="'+k+'">'+k+'<\/option>');
}
//-->
</script>
</select>

</body>
</html>

3. write a test to test the test html
        location = 'test.html'
        data = open(location)
        parser = html5lib.HTMLParser()
        tree = parser.parse(data)

        walker = treewalkers.getTreeWalker("simpletree")
        stream = walker(tree)
        html_serializer = serializer.htmlserializer.HTMLSerializer()
        parse_output = html_serializer.render(stream)
        print >> parse_output

What is the expected output? What do you see instead?
1. expect output:
<html><head></head><body>

<select name="CISOOP2" title="Search options.">

<script language="JavaScript" type="text/javascript">
<!--
for(k=0;k<3;k++){
document.writeln('<option value="'+k+'">'+k+'<\/option>');
}
//-->
</script>

</select>

</body></html>

2. actual output
<html><head></head><body>

<select name="CISOOP2" title="Search options.">

<!--
for(k=0;k<3;k++){
document.writeln('<option value="'+k+'">'+k+'<\/option>');
}
//-->

</select>

</body></html> 

Please provide any additional information below.
any information needed, please contact gxRocky@gmail.com

Original issue reported on code.google.com by gxRo...@gmail.com on 11 Aug 2010 at 1:00

GoogleCodeExporter commented 9 years ago
As I know, make class "InSelectPhase" to support "script" tag will fix this 
problem, am I right?

Original comment by gxRo...@gmail.com on 11 Aug 2010 at 1:14

GoogleCodeExporter commented 9 years ago
As far as I can tell, this works now.

Original comment by ja...@hoppipolla.co.uk on 13 Mar 2011 at 5:59