marijnh/CodeMirror2 — Issue #431: error in htmlmixed.js, function javascript(stream, state) did not return correct state 
Author: tlindig
Created: 2012-03-07 11:57:58+00:00
State: open

Hi,

in the file htmlmixed.js instead of:

31: state.curState = null;

should be there:

31: state.localState = null;

because `state.curState` is never used, but `state.localState`.

The old code seams to have no bad effect in the current implementation of htmlmixed mode, only may be some performance issues, because the `localeState` will be copied in `copyState: function(state)` without need.

The new code worked fine.

here the unidiff:

mode/htmlmixed/htmlmixed.js | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mode/htmlmixed/htmlmixed.js b/mode/htmlmixed/htmlmixed.js
index a94dc45..c66a658 100644
--- a/mode/htmlmixed/htmlmixed.js
+++ b/mode/htmlmixed/htmlmixed.js
@@ -28,7 +28,7 @@ CodeMirror.defineMode("htmlmixed", function(config, parserConfig) {
function javascript(stream, state) {
if (stream.match(/^<\/\s*script\s*>/i, false)) {
state.token = html;
- state.curState = null;
+ state.localState = null;
state.mode = "html";
return html(stream, state);
}