Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 324002 - Formating of JavaScript corrupts source
Summary: Formating of JavaScript corrupts source
Status: CLOSED DUPLICATE of bug 319855
Alias: None
Product: JSDT
Classification: WebTools
Component: Web (show other bugs)
Version: 3.1   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Ian Tewksbury CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-30 13:40 EDT by Terry Denney CLA
Modified: 2010-08-31 08:33 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Terry Denney CLA 2010-08-30 13:40:40 EDT
Formating a HTML page with JavaScript having a html tags in a String corrupts the source.
e.g.
alert("<div></div>")
results in 
alert("_$tag</div>")

Reproduce with this simple html and execute "Source > Format"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
	alert("<div></div>")
</script>
</head>
<body>
</html>

As a result the first '<div>' will be replaced with '_$tag'.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
	alert("_$tag</div>")
</script>
</head>
<body>
</html>

Every further execution will change the next tag too, so after two format executions, it will end as:
alert("_$tag_$tag_")
Comment 1 Ian Tewksbury CLA 2010-08-31 08:33:06 EDT

*** This bug has been marked as a duplicate of bug 319855 ***