Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 320001 - [ui] The editor adds hyphens in front of the end tag of the SCRIPT HTML element.
Summary: [ui] The editor adds hyphens in front of the end tag of the SCRIPT HTML element.
Status: RESOLVED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: jst.jsp (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2.3   Edit
Assignee: Sarika Sinha CLA
QA Contact: Nick Sandonato CLA
URL:
Whiteboard:
Keywords:
: 338806 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-07-15 11:23 EDT by Johannes Schade CLA
Modified: 2011-03-03 08:59 EST (History)
3 users (show)

See Also:
nsand.dev: review+


Attachments
Add smart insertion for jsp comments inside jsp scriptlets only (1.65 KB, patch)
2010-09-17 05:18 EDT, Sarika Sinha CLA
nsand.dev: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Johannes Schade CLA 2010-07-15 11:23:21 EDT
Build Identifier: 20100617-1415

When JSP comments are used inside the HTML SCRIPT element and the leading tag of the comment ("<%--") happens to be deleted and then added in again in the process of the editing, the editor adds a pair of hyphens in front of the end tag of the SCRIPT tag (--</scipt>). The user might not be aware of this addition when the content of the SCRIPT element is long. The leading hyphens usually result in loss of functionality on the page, probably because the end tag of script is not recognised any more by at least some browsers. For example a button that does not work any more.

Reproducible: Always

Steps to Reproduce:
1. Create a new JSP page using Eclipse (new -> JSP File)
2. Add a SCRIPT element under the HEAD element under the TITLE element
3. Enter a JSP comment (<%-- --%>) in side the SCRIPT element.
4. Delete the start tag of the comment
5. Type the strat tag of the comment in again
6. Observe that the editor adds two hyphens in front of the end tag of the SCRIPT element
Comment 1 Johannes Schade CLA 2010-08-26 06:34:37 EDT
I found a similar but slightly different case, which I think is caused by the same bug and may be helpful to understand its behaviour better. Consider the following scenario:
(1) Create a JSP file as before and open it in the JSP Editor.
(2) Add a SCRIPT element.
(3) Add the following code:
    t = "";
    if (t.length > 0 {
        alert("hello");
    }
(4) Add a JSP comment above the code so that the content of the SCRIPT element becomes:
    <%--

    // Comment. --%>
    t = "";
    if (t.length > 0 {
        alert("hello");
    }
(5) Save
(6) Observe the appearance of red zig-zag underlining (usually under the zero).

Of course there is nothing wrong and the syntax checker should not underline anything. It seems it find a problem with the ">" comparator in the code but only once the comment has been added.

Best regards, Johannes
Comment 2 Chris Jaun CLA 2010-09-16 15:12:48 EDT
(In reply to comment #1)
> I found a similar but slightly different case, which I think is caused by the
> same bug and may be helpful to understand its behaviour better. Consider the
> following scenario:
> (1) Create a JSP file as before and open it in the JSP Editor.
> (2) Add a SCRIPT element.
> (3) Add the following code:
>     t = "";
>     if (t.length > 0 {
>         alert("hello");
>     }
> (4) Add a JSP comment above the code so that the content of the SCRIPT element
> becomes:
>     <%--
> 
>     // Comment. --%>
>     t = "";
>     if (t.length > 0 {
>         alert("hello");
>     }
> (5) Save
> (6) Observe the appearance of red zig-zag underlining (usually under the zero).
> 
> Of course there is nothing wrong and the syntax checker should not underline
> anything. It seems it find a problem with the ">" comparator in the code but
> only once the comment has been added.
> 
> Best regards, Johannes

The syntax error is correct. You don't have the closing ) after the 0.

The first problem I can reproduce, but I don't think its a JSDT problem.
Comment 3 Sarika Sinha CLA 2010-09-17 05:18:24 EDT
Created attachment 179093 [details]
Add smart insertion for jsp comments inside jsp scriptlets only

Added the check to insert auto completion of jsp comment syntax inside scriptlets ony.Currently it was adding "--" even if the parent node is is naything oter than scriptlet, like <script>
Comment 4 Nick Sandonato CLA 2010-09-20 15:42:14 EDT
Thanks, Sarika. I've checked in the changes to HEAD, but we'll have to wait until 3.2.3 opens up.
Comment 5 Nick Sandonato CLA 2010-10-01 17:01:15 EDT
Code checked in to 3_2_Maintenance.
Comment 6 Nick Sandonato CLA 2011-03-03 08:59:15 EST
*** Bug 338806 has been marked as a duplicate of this bug. ***