Hello,
I am one of the core developers behind Gaia Ajax Widgets http://ajaxwidgets.com/. We rely heavily on the awesome prototype JS library. We have several simple patches and fixes that we add to prototype.js, every time we upgrade our product to use a newer version of prototype. We thought you would be interested if we share those with you. I will be talking about the latest release of prototype.js (1.6.0.2)
Here it goes:
Patch to support broken connections in Firefox
- Function that has the problem (line number: 1188):
request: function(url)
- Fix: Before this line of code (line number: 1214):
this.transport.open(this.method.toUpperCase(), this.url, this.options.asynchronous);
we add the following line of code:
if (Prototype.Browser.Gecko)
this.transport.onerror = function(e){this.dispatchException(e);}.bind(this);
Problem causes element.style to be undefined in IE6
- Line numbers: 2238, 2239 and 2240
var offsetParent = element.getOffsetParent();
if (offsetParent && offsetParent.getStyle('position') === 'fixed')
offsetParent.setStyle({ zoom: 1 });
- Fix: We commented those lines out
Problem that causes JS error when Event.stop is called
- Symptom: When Event.stop(event) is called sometimes it gives an error, undefined function event.preventDefault in the browsers that only support event.stopPropagation and vice versa
- Function that has the problem: Event.Methods, specifically the stop function (line number: 3799)
stop: function(event)
- Fix: We added if checks before the calls:
if( event.preventDefault )
event.preventDefault();
if( event.stopPropagation )
event.stopPropagation();
Accurate Value for cumulativeOffset
This fix was introduced to us by one of our customers http://www.multicase.no/
- Function that has the problem (line number: 2004):
cumulativeOffset: function(element)
- Fix provided by Odd Henrik from Multicase:
cumulativeOffset: function(element) {
var valueT = 0, valueL = 0;
var lastElement = element;
do {
valueT += element.offsetTop || 0;
valueL += element.offsetLeft || 0;
// Odd-Henrik - MultiCase patch...
valueT += parseInt(element.style.borderTopWidth) || 0;
valueL += parseInt(element.style.borderLeftWidth) || 0;
element = element.offsetParent;
} while (element);
return Element._returnOffset(valueL - (parseInt(lastElement.style.borderLeftWidth) || 0),
valueT - (parseInt(lastElement.style.borderTopWidth) || 0));
},
I included the patched version of 1.6.0.2 that we are using in our product, you can search for "gaia" to find our fixes and search for "Odd-Henrik" to find his fix.
Thank you for this awesome library,
Kariem Ali