Changeset 1025 for trunk


Ignore:
Timestamp:
08/23/08 16:27:39 (11 years ago)
Author:
ray
Message:

#1265 [TransformInnerHTML] Patch for correct handling of definition lists (dl, dt, dd)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/modules/GetHtml/TransformInnerHTML.js

    r961 r1025  
    4848/*12*/  /\s+contenteditable(=[^>\s\/]*)?/gi,//strip contenteditable 
    4949/*13*/  /((href|src)=")([^\s]*)"/g, //find href and src for stripBaseHref() 
    50 /*14*/  /<\/?(div|p|h[1-6]|table|tr|td|th|ul|ol|li|blockquote|object|br|hr|img|embed|param|pre|script|html|head|body|meta|link|title|area|input|form|textarea|select|option)[^>]*>/g, 
    51 /*15*/  /<\/(div|p|h[1-6]|table|tr|ul|ol|blockquote|object|html|head|body|script|form|select)( [^>]*)?>/g,//blocklevel closing tag 
    52 /*16*/  /<(div|p|h[1-6]|table|tr|ul|ol|blockquote|object|html|head|body|script|form|select)( [^>]*)?>/g,//blocklevel opening tag 
    53 /*17*/  /<(td|th|li|option|br|hr|embed|param|pre|meta|link|title|area|input|textarea)[^>]*>/g,//singlet tag or output on 1 line 
     50/*14*/  /<\/?(div|p|h[1-6]|table|tr|td|th|ul|ol|li|dl|dt|dd|blockquote|object|br|hr|img|embed|param|pre|script|html|head|body|meta|link|title|area|input|form|textarea|select|option)[^>]*>/g, 
     51/*15*/  /<\/(div|p|h[1-6]|table|tr|ul|ol|dl|blockquote|object|html|head|body|script|form|select)( [^>]*)?>/g,//blocklevel closing tag 
     52/*16*/  /<(div|p|h[1-6]|table|tr|ul|ol|dl|blockquote|object|html|head|body|script|form|select)( [^>]*)?>/g,//blocklevel opening tag 
     53/*17*/  /<(td|th|li|dt|dd|option|br|hr|embed|param|pre|meta|link|title|area|input|textarea)[^>]*>/g,//singlet tag or output on 1 line 
    5454/*18*/  /(^|<\/(pre|script)>)(\s|[^\s])*?(<(pre|script)[^>]*>|$)/g,//find content NOT inside pre and script tags 
    5555/*19*/  /(<pre[^>]*>)([\s\S])*?(<\/pre>)/g,//find content inside pre tags 
     
    196196                        return strn; 
    197197                }); 
    198                 //IE drops  all </li> tags in a list except the last one 
     198                //IE drops  all </li>,</dt>,</dd> tags in a list except the last one 
    199199                if(Xinha.is_ie) { 
    200                         html = html.replace(/<li( [^>]*)?>/g,'</li><li$1>'). 
    201                                 replace(/(<(ul|ol)[^>]*>)[\s\n]*<\/li>/g, '$1'). 
    202                                 replace(/<\/li>([\s\n]*<\/li>)+/g, '<\/li>'); 
     200                        html = html.replace(/<(li|dd|dt)( [^>]*)?>/g,'</$1><$1$2>'). 
     201                                replace(/(<[uod]l[^>]*>[\s\S]*?)<\/(li|dd|dt)>/g, '$1'). 
     202                                replace(/\s*<\/(li|dd|dt)>(\s*<\/(li|dd|dt)>)+/g, '</$1>'). 
     203                                replace(/(<dt[\s>][^<]*)(<\/d[dt]>)+/g, '$1</dt>'); 
    203204                } 
    204205                if(Xinha.is_gecko) 
    205206                        html = html.replace(/<br \/>\n$/, ''); //strip trailing <br> added by moz 
     207                //Cleanup redundant whitespace before </li></dd></dt> in IE and Mozilla 
     208                html = html.replace(/\s*(<\/(li|dd|dt)>)/g, '$1'); 
    206209                if (outputRoot) { 
    207210                        html += "</" + root_tag + ">"; 
Note: See TracChangeset for help on using the changeset viewer.