Ticket #1081 (closed defect: fixed)
Control character is not being removed inside SCRIPT tags or HEAD when switching from textmode to htmlmode.
| Reported by: | guest | Owned by: | gogo |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Xinha Core | Version: | |
| Severity: | normal | Keywords: | cursor, script, javascript, cursor position |
| Cc: |
Description
The control character that keeps track of the cursor position when switching from textmode to htmlmode is not being removed when the cursor is somewhere inside a SCRIPT tag. This breaks inline javascripts when you are editing them via Xinha.
Example, (I use the pipe character (|), to indicate cursor position): Textmode:
<p>Some html</p> <script type="text/javascript"> ale|rt(1); </script> <div>more html</div>
When switching back to htmlmode, the cursor position is saved by adding an extra control character in htmlcode. But apparently this control character is not being removed inside script tags. If we switch back to text mode, we will see a space character in the script (IE 6):
<p>Some html</p> <script type="text/javascript"> ale rt(1); </script> <div>more html</div>
In Firefox the control character is invisible in textmode, but it is there!
This bug is present in (at least) IE (version 6.3790.3959) and Firefox (version 2.0.0.7).
The problem is in the findCC method in the modules/InternetExplorer/InternetExplorer.js and modules/Gecko/Gecko.js files. This method doesn't find the control character. I think that the selection does not work inside script tags (in fac I am almost sure about that). So I think the best solution is to check if the cursor is inside a script tag (in the setCC method) and if that's the case, place the cursor right before or right after that script tag.
You can e-mail me at: joris [at] prezent [dot] nl
