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

Ticket #8851: Fix_IE_memory_leak.patch

File Fix_IE_memory_leak.patch, 1.5 kB (added by jamesots, 2 years ago)
  • resources/js/prototype.js

    old new  
    399399  } 
    400400}); 
    401401 
    402 if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.prototype, { 
    403   escapeHTML: function() { 
    404     return this.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;'); 
    405   }, 
    406   unescapeHTML: function() { 
    407     return this.replace(/&amp;/g,'&').replace(/&lt;/g,'<').replace(/&gt;/g,'>'); 
    408   } 
    409 }); 
     402if (Prototype.Browser.WebKit || Prototype.Browser.IE) { 
     403  Object.extend(String.prototype, { 
     404    escapeHTML: function() { 
     405      return this.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;'); 
     406    }, 
     407    unescapeHTML: function() { 
     408      return this.replace(/&amp;/g,'&').replace(/&lt;/g,'<').replace(/&gt;/g,'>'); 
     409    } 
     410  }); 
     411} else { 
     412  Object.extend(String.prototype.escapeHTML, { 
     413    div:  document.createElement('div'), 
     414    text: document.createTextNode('') 
     415  }); 
    410416 
     417  with (String.prototype.escapeHTML) div.appendChild(text); 
     418} 
     419 
    411420String.prototype.gsub.prepareReplacement = function(replacement) { 
    412421  if (typeof replacement == 'function') return replacement; 
    413422  var template = new Template(replacement); 
     
    416425 
    417426String.prototype.parseQuery = String.prototype.toQueryParams; 
    418427 
    419 Object.extend(String.prototype.escapeHTML, { 
    420   div:  document.createElement('div'), 
    421   text: document.createTextNode('') 
    422 }); 
    423  
    424 with (String.prototype.escapeHTML) div.appendChild(text); 
    425  
    426428var Template = Class.create(); 
    427429Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/; 
    428430Template.prototype = {