From 4bd2b9b87a343bb942e51622043d25c219207324 Mon Sep 17 00:00:00 2001 From: RaymondLim Date: Wed, 18 Jul 2012 21:57:53 -0700 Subject: [PATCH 1/3] Don't create an html tag info for an invalid html tag inside a style block. --- src/language/HTMLUtils.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/language/HTMLUtils.js b/src/language/HTMLUtils.js index 9e2992009b2..c4896fef56b 100644 --- a/src/language/HTMLUtils.js +++ b/src/language/HTMLUtils.js @@ -330,6 +330,11 @@ define(function (require, exports, module) { } if (ctx.token.className === "tag") { + // check if this is inside a style block. + if (editor.getModeForSelection() !== "html") { + return createTagInfo(); + } + //check to see if this is the closing of a tag (either the start or end) if (ctx.token.string === ">" || (ctx.token.string.charAt(0) === "<" && ctx.token.string.charAt(1) === "/")) { From 70524e00f0944d8632812ee7c86c7bf40ba6ab22 Mon Sep 17 00:00:00 2001 From: RaymondLim Date: Thu, 19 Jul 2012 16:17:53 -0700 Subject: [PATCH 2/3] Make mode checking as the first one in this function before checking others. --- src/language/HTMLUtils.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/language/HTMLUtils.js b/src/language/HTMLUtils.js index c4896fef56b..f099a14e9ef 100644 --- a/src/language/HTMLUtils.js +++ b/src/language/HTMLUtils.js @@ -289,6 +289,11 @@ define(function (require, exports, module) { tagInfo, tokenType; + // check if this is inside a style block. + if (ctx.token.className === "tag" && editor.getModeForSelection() !== "html") { + return createTagInfo(); + } + //check and see where we are in the tag if (ctx.token.string.length > 0 && ctx.token.string.trim().length === 0) { @@ -330,11 +335,6 @@ define(function (require, exports, module) { } if (ctx.token.className === "tag") { - // check if this is inside a style block. - if (editor.getModeForSelection() !== "html") { - return createTagInfo(); - } - //check to see if this is the closing of a tag (either the start or end) if (ctx.token.string === ">" || (ctx.token.string.charAt(0) === "<" && ctx.token.string.charAt(1) === "/")) { From d25d1e773ff485c45a7ab5164c21895bdcd86fd8 Mon Sep 17 00:00:00 2001 From: RaymondLim Date: Thu, 19 Jul 2012 17:56:40 -0700 Subject: [PATCH 3/3] Remove the unneeded check of ctx.token.className. --- src/language/HTMLUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/language/HTMLUtils.js b/src/language/HTMLUtils.js index f099a14e9ef..ff9cad16c64 100644 --- a/src/language/HTMLUtils.js +++ b/src/language/HTMLUtils.js @@ -290,7 +290,7 @@ define(function (require, exports, module) { tokenType; // check if this is inside a style block. - if (ctx.token.className === "tag" && editor.getModeForSelection() !== "html") { + if (editor.getModeForSelection() !== "html") { return createTagInfo(); }