Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #8182: prototype-1.5.1-element-update.patch

File prototype-1.5.1-element-update.patch, 2.5 kB (added by alar, 2 years ago)

prototype-1.5.1-element-update.patch

  • prototype.js

    old new  
    1010  Version: '1.5.1', 
    1111 
    1212  Browser: { 
    13     IE:     !!(window.attachEvent && !window.opera), 
    14     Opera:  !!window.opera, 
    15     WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1, 
    16     Gecko:  navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1 
     13    IE:        !!(window.attachEvent && !window.opera), 
     14    Opera:     !!window.opera, 
     15    WebKit:    navigator.userAgent.indexOf('AppleWebKit/') > -1, 
     16    Gecko:     navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1, 
     17    Konqueror: navigator.vendor && navigator.vendor.indexOf('KDE') > -1 
    1718  }, 
    1819 
    1920  BrowserFeatures: { 
     
    17201721      'alpha(opacity=' + (value * 100) + ')'; 
    17211722    return element; 
    17221723  }; 
    1723  
    1724   // IE is missing .innerHTML support for TABLE-related elements 
     1724
     1725else if (Prototype.Browser.Gecko) { 
     1726  Element.Methods.setOpacity = function(element, value) { 
     1727    element = $(element); 
     1728    element.style.opacity = (value == 1) ? 0.999999 : 
     1729      (value === '') ? '' : (value < 0.00001) ? 0 : value; 
     1730    return element; 
     1731  }; 
     1732
     1733if (Prototype.Browser.IE || Prototype.Browser.Konqueror) { 
     1734  // IE and Konqueror are missing .innerHTML support for TABLE-related elements 
    17251735  Element.Methods.update = function(element, html) { 
    17261736    element = $(element); 
    17271737    html = typeof html == 'undefined' ? '' : html.toString(); 
    17281738    var tagName = element.tagName.toUpperCase(); 
    1729     if (['THEAD','TBODY','TR','TD'].include(tagName)) { 
     1739    if ((Prototype.Browser.Konqueror && ['TABLE','THEAD','TFOOT','TBODY'].include(tagName)) 
     1740      || (Prototype.Browser.IE && ['TABLE','THEAD','TFOOT','TBODY','TR','TD'].include(tagName))) { 
    17301741      var div = document.createElement('div'); 
    17311742      switch (tagName) { 
     1743        case 'TABLE': 
     1744          div.innerHTML = '<table>' +  html.stripScripts() + '</table>'; 
     1745          depth = 1; 
     1746          break; 
    17321747        case 'THEAD': 
     1748        case 'TFOOT': 
    17331749        case 'TBODY': 
    17341750          div.innerHTML = '<table><tbody>' +  html.stripScripts() + '</tbody></table>'; 
    17351751          depth = 2; 
     
    17501766    } 
    17511767    setTimeout(function() { html.evalScripts() }, 10); 
    17521768    return element; 
    1753   } 
    1754 } 
    1755 else if (Prototype.Browser.Gecko) { 
    1756   Element.Methods.setOpacity = function(element, value) { 
    1757     element = $(element); 
    1758     element.style.opacity = (value == 1) ? 0.999999 : 
    1759       (value === '') ? '' : (value < 0.00001) ? 0 : value; 
    1760     return element; 
    17611769  }; 
    17621770} 
    17631771