#18357077 : IE에서 P 노드가 정상적으로 생성되지 않는 경우 수정

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@6902 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
taggon 2009-10-29 10:10:14 +00:00
parent d8c6bb565a
commit 3e767c202e

View file

@ -177,8 +177,25 @@ function editorGetContentTextarea_xe(editor_sequence) {
if (!oEditor) return '';
var str = oEditor.getIR();
if(!jQuery.trim(str.replace(/(&nbsp;|<\/?(p|br|span|div)([^>]+)?>)/ig, ''))) return '';
// 속도 문제가 있으므로 1024 문자 미만일 때만 첫 노드가 텍스트 노드인지 테스트
// 그 이상이면 P 노드가 정상적으로 생성되었다고 가정한다.
if (str.length < 1024) {
var div = jQuery('<div>'+str+'</div>').eq(0);
var nodes = div.contents();
jQuery.each(nodes, function() {
if (this.nodeType == 3) {
jQuery(this).wrap('<p></p>');
}
});
str = div.html();
}
// 파이어폭스의 경우 의미없는 <br>이 컨텐트 마지막에 추가될 수 있다.
str = str.replace(/<br ?\/?>$/i, '');
return str;
}