This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 152042 - for loop in javascript blocks in xhtml pages incorrectly mark '<' as correct syntax
Summary: for loop in javascript blocks in xhtml pages incorrectly mark '<' as correct ...
Status: NEW
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Petr Pisl
URL:
Keywords:
: 199890 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-10-31 21:38 UTC by robertmcauliffe
Modified: 2013-07-18 08:29 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Correct XHTML, fails Netbeans error highlighting (399 bytes, text/xml)
2008-10-31 21:45 UTC, robertmcauliffe
Details
Inorrect XHTML, passes Netbeans error highlighting (396 bytes, text/xml)
2008-10-31 21:45 UTC, robertmcauliffe
Details
useless prototype (9.59 KB, patch)
2012-12-07 08:10 UTC, Martin Fousek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description robertmcauliffe 2008-10-31 21:38:15 UTC
When creating an xhtml page, if there is a javascript block (within a <script> tag) which contains the < character, the
error highlighting (red squiggly line) does not show it as an error. Also putting the correct markup ('&lt;') does cause
errors to be displayed.

Note that the xhtml tested against validated as correct against the w3c validator, and the incorrect version was marked
as such (again by the w3c validator).

To replicate: create an xhtml page with the correct doctype etc.  Add a <script> tag and enter a for loop.

Example 1:
<script type="text/javascript">
  for (var i = 0; i < 10 ; i++ )
  {
  
  }
</script>


Example 2:
<script type="text/javascript">
  for (var i = 0; i &lt; 10 ; i++ )
  {
  
  }
</script>


Example 1 validates as incorrect against w3c, but correct in netbeans inline error marking. Example 2 validates as
correct against w3c, but incorrect in netbeans inline error marking.
Comment 1 robertmcauliffe 2008-10-31 21:45:15 UTC
Created attachment 73023 [details]
Correct XHTML, fails Netbeans error highlighting
Comment 2 robertmcauliffe 2008-10-31 21:45:49 UTC
Created attachment 73024 [details]
Inorrect XHTML, passes Netbeans error highlighting
Comment 3 Marek Fukala 2009-04-24 16:42:19 UTC
We do not interpret the embedded javascript code now, should be easy to do in JsEmbeddingProvider.

As for the missing error, you are right, but currently we have almost no error checks for XHTML :-|
Comment 4 Petr Pisl 2011-10-17 14:16:20 UTC
This looks like a problem with JS embedding into xhtml. Should be solved on the xhtml site.
Comment 5 Marek Fukala 2011-11-03 16:08:17 UTC
*** Bug 199890 has been marked as a duplicate of this bug. ***
Comment 6 Marek Fukala 2012-12-05 13:28:04 UTC
The first sample is now correctly as erroneous - complains about the unquoted "<" char in the script.

Second issue is reproducible - needs to be fixed in JsEmbeddingProvider from javascript2.editor.
Comment 7 Martin Fousek 2012-12-07 08:10:37 UTC
Created attachment 129026 [details]
useless prototype

I created some kind of prototype, but finally I found out that it's unusable since we should be able to decode all special entities so probably some kind of better encoder class should be created. Anyway I was at least able to test out basic editor functionality with parts of created embeddings (not translatable to the original offset) and it looked to be working pretty well.