Changeset 961 for trunk/modules/GetHtml


Ignore:
Timestamp:
02/02/08 18:30:42 (11 years ago)
Author:
ray
Message:

#1143 add Safari support

Location:
trunk/modules/GetHtml
Files:
2 edited

Legend:

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

    r943 r961  
    147147          } 
    148148          var name = a.nodeName.toLowerCase(); 
    149           if ( /_moz_editor_bogus_node/.test(name) ) 
     149          if ( /_moz_editor_bogus_node/.test(name) || ( name == 'class' && a.nodeValue == 'webkit-block-placeholder') ) 
    150150          { 
    151151            html = ""; 
     
    181181            { 
    182182              value = a.nodeValue; 
     183                          if (name == 'class') 
     184                          { 
     185                                value = value.replace(/Apple-style-span/,''); 
     186                                if (!value) continue; 
     187                          } 
    183188              // IE seems not willing to return the original values - it converts to absolute 
    184189              // links using a.nodeValue, a.value, a.stringValue, root.getAttribute("href") 
  • trunk/modules/GetHtml/TransformInnerHTML.js

    r919 r961  
    3434 
    3535Xinha.RegExpCache = [ 
    36 /*00*/  new RegExp().compile(/<\s*\/?([^\s\/>]+)[\s*\/>]/gi),//lowercase tags 
    37 /*01*/  new RegExp().compile(/(\s+)_moz[^=>]*=[^\s>]*/gi),//strip _moz attributes 
    38 /*02*/  new RegExp().compile(/\s*=\s*(([^'"][^>\s]*)([>\s])|"([^"]+)"|'([^']+)')/g),// find attributes 
    39 /*03*/  new RegExp().compile(/\/>/g),//strip singlet terminators 
    40 /*04*/  new RegExp().compile(/<(br|hr|img|input|link|meta|param|embed|area)((\s*\S*="[^"]*")*)>/g),//terminate singlet tags 
    41 /*05*/  new RegExp().compile(/(<\w+\s+(\w*="[^"]*"\s+)*)(checked|compact|declare|defer|disabled|ismap|multiple|no(href|resize|shade|wrap)|readonly|selected)([\s>])/gi),//expand singlet attributes 
    42 /*06*/  new RegExp().compile(/(="[^']*)'([^'"]*")/),//check quote nesting 
    43 /*07*/  new RegExp().compile(/&(?=(?!(#[0-9]{2,5};|[a-zA-Z0-9]{2,6};|#x[0-9a-fA-F]{2,4};))[^<]*>)/g),//expand query ampersands not in html entities 
    44 /*08*/  new RegExp().compile(/<\s+/g),//strip tagstart whitespace 
    45 /*09*/  new RegExp().compile(/\s+(\/)?>/g),//trim whitespace 
    46 /*10*/  new RegExp().compile(/\s{2,}/g),//trim extra whitespace 
    47 /*11*/  new RegExp().compile(/\s+([^=\s]+)((="[^"]+")|([\s>]))/g),// lowercase attribute names 
    48 /*12*/  new RegExp().compile(/\s+contenteditable(=[^>\s\/]*)?/gi),//strip contenteditable 
    49 /*13*/  new RegExp().compile(/((href|src)=")([^\s]*)"/g), //find href and src for stripBaseHref() 
    50 /*14*/  new RegExp().compile(/<\/?(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*/  new RegExp().compile(/<\/(div|p|h[1-6]|table|tr|ul|ol|blockquote|object|html|head|body|script|form|select)( [^>]*)?>/g),//blocklevel closing tag 
    52 /*16*/  new RegExp().compile(/<(div|p|h[1-6]|table|tr|ul|ol|blockquote|object|html|head|body|script|form|select)( [^>]*)?>/g),//blocklevel opening tag 
    53 /*17*/  new RegExp().compile(/<(td|th|li|option|br|hr|embed|param|pre|meta|link|title|area|input|textarea)[^>]*>/g),//singlet tag or output on 1 line 
    54 /*18*/  new RegExp().compile(/(^|<\/(pre|script)>)(\s|[^\s])*?(<(pre|script)[^>]*>|$)/g),//find content NOT inside pre and script tags 
    55 /*19*/  new RegExp().compile(/(<pre[^>]*>)([\s\S])*?(<\/pre>)/g),//find content inside pre tags 
    56 /*20*/  new RegExp().compile(/(^|<!--[\s\S]*?-->)([\s\S]*?)(?=<!--[\s\S]*?-->|$)/g),//find content NOT inside comments 
    57 /*21*/  new RegExp().compile(/\S*=""/g), //find empty attributes 
    58 /*22*/  new RegExp().compile(/<!--[\s\S]*?-->|<\?[\s\S]*?\?>|<\/?\w[^>]*>/g), //find all tags, including comments and php 
    59 /*23*/  new RegExp().compile(/(^|<\/script>)[\s\S]*?(<script[^>]*>|$)/g) //find content NOT inside script tags 
     36/*00*/  /<\s*\/?([^\s\/>]+)[\s*\/>]/gi,//lowercase tags 
     37/*01*/  /(\s+)_moz[^=>]*=[^\s>]*/gi,//strip _moz attributes 
     38/*02*/  /\s*=\s*(([^'"][^>\s]*)([>\s])|"([^"]+)"|'([^']+)')/g,// find attributes 
     39/*03*/  /\/>/g,//strip singlet terminators 
     40/*04*/  /<(br|hr|img|input|link|meta|param|embed|area)((\s*\S*="[^"]*")*)>/g,//terminate singlet tags 
     41/*05*/  /(<\w+\s+(\w*="[^"]*"\s+)*)(checked|compact|declare|defer|disabled|ismap|multiple|no(href|resize|shade|wrap)|readonly|selected)([\s>])/gi,//expand singlet attributes 
     42/*06*/  /(="[^']*)'([^'"]*")/,//check quote nesting 
     43/*07*/  /&(?=(?!(#[0-9]{2,5};|[a-zA-Z0-9]{2,6};|#x[0-9a-fA-F]{2,4};))[^<]*>)/g,//expand query ampersands not in html entities 
     44/*08*/  /<\s+/g,//strip tagstart whitespace 
     45/*09*/  /\s+(\/)?>/g,//trim whitespace 
     46/*10*/  /\s{2,}/g,//trim extra whitespace 
     47/*11*/  /\s+([^=\s]+)((="[^"]+")|([\s>]))/g,// lowercase attribute names 
     48/*12*/  /\s+contenteditable(=[^>\s\/]*)?/gi,//strip contenteditable 
     49/*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 
     54/*18*/  /(^|<\/(pre|script)>)(\s|[^\s])*?(<(pre|script)[^>]*>|$)/g,//find content NOT inside pre and script tags 
     55/*19*/  /(<pre[^>]*>)([\s\S])*?(<\/pre>)/g,//find content inside pre tags 
     56/*20*/  /(^|<!--[\s\S]*?-->)([\s\S]*?)(?=<!--[\s\S]*?-->|$)/g,//find content NOT inside comments 
     57/*21*/  /\S*=""/g, //find empty attributes 
     58/*22*/  /<!--[\s\S]*?-->|<\?[\s\S]*?\?>|<\/?\w[^>]*>/g, //find all tags, including comments and php 
     59/*23*/  /(^|<\/script>)[\s\S]*?(<script[^>]*>|$)/g //find content NOT inside script tags 
    6060]; 
    61  
     61// compile for performance; WebKit doesn't support this 
     62if (typeof RegExp.prototype.compile == 'function') { 
     63        for (var i=0; i<Xinha.RegExpCache.length;i++ ) { 
     64                Xinha.RegExpCache[i] = new RegExp().compile(Xinha.RegExpCache[i]); 
     65        } 
     66} 
    6267/**  
    6368  * Cleans HTML into wellformed xhtml 
Note: See TracChangeset for help on using the changeset viewer.