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

Ticket #4477: prototype-perf-patch.diff

File prototype-perf-patch.diff, 1.0 kB (added by Thomas Fuchs <t.fuchs@wollzelle.com>, 4 years ago)

Patch to make $ faster on Firefox and Safari

  • prototype.js

    old new  
    900900 
    901901Element.extend = function(element) { 
    902902  if (!element) return; 
     903  if (_nativeExtensions) return element; 
    903904 
    904905  if (!element._extended && element.tagName && element != window) { 
    905906    var methods = Element.Methods, cache = Element.extend.cache; 
     
    11131114 
    11141115Object.extend(Element, Element.Methods); 
    11151116 
     1117var _nativeExtensions = false; 
     1118 
     1119if(!/MSIE/.test(navigator.userAgent)) { 
     1120 
     1121  if((typeof HTMLElement == 'undefined') &&  
     1122    (/Konqueror|Safari|KHTML/.test(navigator.userAgent))) { 
     1123    var HTMLElement = {}; 
     1124    HTMLElement.prototype =  
     1125      document.createElement('html').constructor.__proto__.__proto__; 
     1126  } 
     1127 
     1128  if(typeof HTMLElement != 'undefined') { 
     1129    Object.extend(HTMLElement.prototype, Element.Methods); 
     1130    _nativeExtensions = true; 
     1131  } 
     1132} 
     1133 
    11161134var Toggle = new Object(); 
    11171135Toggle.display = Element.toggle; 
    11181136