PreviousNextTracker indexSee it online !

(11/22) 3614699 - HTML mode: Fix mode properties in <script> blocks.

Fix #3614631 by delegating to script modes, instead of just importing their rules.

The indentation rules for the script mode are only applied if (real) delegation is used. (Some relevant code can be found in JEditBuffer.getIndentRules)

This patch also shortens and simplifies the file nicely, but for the price of reintroducing a corner-case bug: Closing </script> tags may be consumed by script comments, which is inconsistent with the XML plugin and most browsers.

Given that it seems impossible to fix this (in a mode file) while using (real) delegation, I'd say that having correct script mode properties is preferable to not having this bug.

(Thanks to Matthieu Casanova for pointing in the right direction.)

Submitted marchaefner - 2013-07-13 - 19:00:20z Assigned daleanson
Priority 5 Category None
Status Open Group None
Resolution None Visibility No

Comments

2013-11-08 - 13:05:52z
marchaefner
Added new version, that also includes a fix for #3615189. (Also renames STRING ruleset to ATTRIBUTE and removes an outdated comment.)
2013-11-11 - 23:07:38z
daleanson
Marc, could you post an example of "Closing </script> tags may be consumed by script comments, which is inconsistent with the XML plugin and most browsers." ?

This patch is looking good to me, and as far as I can tell, even putting a javascript comment in front of the closing script tag looks good.
2013-11-12 - 17:35:18z
marchaefner
Any plain old

<script> // comment </script>

consumes the closing tag (because the comment is matched by an EOL_SPAN). Subsequent text is still highlighted with JavaScript mode, but a look at the SideKick or a test with a browser reveals that it's actually HTML. (Fixing this was one of the goals of #3595104, but it seems to have caused more trouble than good.)
2013-11-26 - 19:23:31z
kerik-sf
Hi,
looks good to me.

What about marking the whole end of attribute invalid when invalid entity is detected ?
replace <SEQ>...</SEQ> with <SEQ_REGEXP TYPE="INVALID">&amp;[^"]*</SEQ_REGEXP>
Otherwise it's rather easy to miss those red &amp; in pink url.

Also, the old html mode will show all the javascript code as comment when viewing the source of this page:
http://www.cs.umd.edu/~bederson/papers/index.html
which the new mode doesn't, which is good!
2013-11-27 - 13:36:18z
marchaefner
> ... it's rather easy to miss those red &amp; in pink url.

Yes that is an issue, but I think that would be better addressed by changing the default colors.

My motivation are users who are forced to work with broken, but nonetheless perfectly well displayed, HTML files. And I strongly suspect HTML5 makes such a scenario even more likely (it "legalizes" some of those broken cases, to be exact).

An overly aggressive error display wouldn't be helpful to those users but a serious distraction. Even more so if they don't use the default color schema (for example my INVALIDs are _really_ red.)

Attachments

2013-07-13 - 19:33:15z
marchaefner
html.xml.patch

HTML mode: Fix bug 3614631 - mode properties in script blocks

2013-11-08 - 13:06:15z
marchaefner
html.xml.V2.patch

Fixes 3614631, 3615189, 3615174