Changeset 755
- Timestamp:
- 02/21/07 04:26:10 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/GetHtml/DOMwalk.js
r742 r755 53 53 54 54 Xinha.emptyAttributes = " checked disabled ismap readonly nowrap compact declare selected defer multiple noresize noshade "; 55 Xinha.elGetsNewLine = function (el) { return (" br meta link title ".indexOf(" " + el.tagName.toLowerCase() + " ") != -1);}; 55 56 56 57 Xinha.getHTMLWrapper = function(root, outputRoot, editor, indent) … … 114 115 html += (Xinha.is_ie ? ('\n' + indent) : '') + "<head>"; 115 116 } 116 // lowercasize117 117 118 var save_multiline = RegExp.multiline; 118 119 RegExp.multiline = true; 119 var txt = root.innerHTML.replace(Xinha.RE_tagName, function(str, p1, p2) { return p1 + p2.toLowerCase(); }); 120 var txt = 121 root.innerHTML.replace(Xinha.RE_tagName, function(str, p1, p2) { return p1 + p2.toLowerCase(); }) // lowercasize 122 .replace(/\s*=\s*(([^'"][^>\s]*)([>\s])|"([^"]+)"|'([^']+)')/g, '="$2$4$5"$3') //add attribute quotes 123 .replace(/<(link|meta)((\s*\S*="[^"]*")*)>/g, '<$1$2 />'); //terminate singlet tags 120 124 RegExp.multiline = save_multiline; 121 125 html += txt + '\n'; … … 129 133 { 130 134 closed = (!(root.hasChildNodes() || Xinha.needsClosingTag(root))); 131 html += ( Xinha.is_ie && Xinha.isBlockElement(root) ? ('\n' + indent) : '') + "<" + root.tagName.toLowerCase();135 html += ((Xinha.isBlockElement(root) || Xinha.elGetsNewLine(root)) ? ('\n' + indent) : '') + "<" + root.tagName.toLowerCase(); 132 136 var attrs = root.attributes; 133 137 … … 280 284 if ( outputRoot && !closed ) 281 285 { 282 html += ( Xinha.is_ie && Xinha.isBlockElement(root) && containsBlock? ('\n' + indent) : '') + "</" + root.tagName.toLowerCase() + ">";286 html += (((Xinha.isBlockElement(root) && containsBlock) || root_tag == 'head' || root_tag == 'html') ? ('\n' + indent) : '') + "</" + root.tagName.toLowerCase() + ">"; 283 287 } 284 288 } … … 286 290 287 291 case 3: // Node.TEXT_NODE 288 html = /^script|noscript|style$/i.test(root.parentNode.tagName) ? root.data : Xinha.htmlEncode(root.data) ;292 html = /^script|noscript|style$/i.test(root.parentNode.tagName) ? root.data : Xinha.htmlEncode(root.data).trim(); 289 293 break; 290 294
Note: See TracChangeset
for help on using the changeset viewer.