From 14c2459992557c8d404b79b457949b94ba03b09a Mon Sep 17 00:00:00 2001 From: flyskyko Date: Thu, 8 Mar 2012 05:26:01 +0000 Subject: [PATCH] issue 1292 fixed close tag error. git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@10383 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- .../skins/xpresseditor/js/Xpress_Editor.js | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/modules/editor/skins/xpresseditor/js/Xpress_Editor.js b/modules/editor/skins/xpresseditor/js/Xpress_Editor.js index 31c0d0afd..66d0e5ec2 100644 --- a/modules/editor/skins/xpresseditor/js/Xpress_Editor.js +++ b/modules/editor/skins/xpresseditor/js/Xpress_Editor.js @@ -5143,7 +5143,6 @@ xe.XE_XHTMLFormatter = $.Class({ TO_IR : function(sContent) { var stack = []; - // remove xeHandled attrs /* sContent = sContent.replace(/xeHandled="YES"/ig,''); @@ -5210,19 +5209,26 @@ xe.XE_XHTMLFormatter = $.Class({ return '<'+tag+' '+$.trim(attrs)+'>'; } else { - stack[stack.length] = {tag:tag, state:state}; + stack.push({tag:tag, state:state}); } } else { var tags = [], t = ''; // remove unnecessary closing tag - if (!stack.length) return ''; + if (!stack.length){ + return ''; + } do { - t = stack.pop(); - if (t.tag != tag) continue; - if (t.state != 'deleted') tags.push(''); - } while(stack.length && t.tag != tag); + t = stack[stack.length-1]; + if (t.tag != tag){ + continue; + } + if (t.state != 'deleted'){ + tags.push(''); + } + stack.pop(); + } while(stack.length && t.tag == tag); return tags.join(''); } @@ -5237,6 +5243,7 @@ xe.XE_XHTMLFormatter = $.Class({ t = stack.pop(); if (t.state != 'deleted') sContent += ''; } while(stack.length); + } return sContent;