diff --git a/lib/coder.js b/lib/coder.js index b5940ba..2553179 100644 --- a/lib/coder.js +++ b/lib/coder.js @@ -173,13 +173,8 @@ var ICEcoder = { if (!ICEcoder.codeBlock) { // OK, we can do something further as we're not in a code block // If it's the same as the previously logged tag preceeded by /, it's the equivalent end tag - if (tagEnd=="/"+ICEcoder.htmlTagArray[ICEcoder.htmlTagArray.length-1]) { - // So remove the last logged tag, thereby going up one in the nest - ICEcoder.htmlTagArray.pop(); - } else { - // Otherwise it's a different tag, add it to the end - ICEcoder.htmlTagArray.push(tagString); - } + // so remove the last logged tag, thereby going up one in the nest, otherwise it's a different tag, add it to the end + tagEnd=="/"+ICEcoder.htmlTagArray[ICEcoder.htmlTagArray.length-1] ? ICEcoder.htmlTagArray.pop() : ICEcoder.htmlTagArray.push(tagString); } else if ( ((ICEcoder.tagStart=="script"||ICEcoder.tagStart=="/script")&&tagEndJS=="0)) { - cM = top.ICEcoder.content.contentWindow['cM'+ICEcoder.cMInstances[ICEcoder.selectedTab-1]]; - } else { - cM = top.ICEcoder.content.contentWindow['cM1']; - } + cM = top.ICEcoder.content.contentWindow[ + newTab=="new"||(newTab!="new" && ICEcoder.openFiles.length>0) + ? 'cM'+ICEcoder.cMInstances[ICEcoder.selectedTab-1] + : 'cM1' + ]; return cM; },