nullpot / phpquery

Automatically exported from code.google.com/p/phpquery
0 stars 0 forks source link

Mangled javascript if contains closing tags in strings #212

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Process HTML that contains <script> tag with HTML in strings. Ex:

<div>
<script>
var html = [
  '<div>',
  '<select>',
  '</select>',
  '</div>',
];
</script>
</div>

What is the expected output? 
I expect the JS code within <script> tag not to be changed.

What do you see instead?
Some closing tags like </select> or </option> are fully removed, and some, like 
</div> are changed to close open tags outside of <script>

What version of the product are you using? On what operating system?
phpQuery 0.9.5

Please provide any additional information below.

Original issue reported on code.google.com by uni...@gmail.com on 11 Apr 2012 at 10:18

GoogleCodeExporter commented 9 years ago
+1 seeing odd result when processing html that contains <script> tags

Original comment by WillFau...@gmail.com on 30 Nov 2012 at 12:54

GoogleCodeExporter commented 9 years ago
I think this is quite a big problem. The contents of a script tag should be 
treated as text content and should not be parsed... I'm getting this problem 
with v0.9.5.386

Original comment by tuh...@gmail.com on 14 May 2013 at 2:44

GoogleCodeExporter commented 9 years ago
I have this problem, too. Has anyone found a workaround for this bug?

Original comment by thomas.o...@gmail.com on 1 Apr 2014 at 7:47