Ticket #403 (closed defect: fixed)
Patch for prototype.js library compatibility
| Reported by: | drifter@… | Owned by: | gogo |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Xinha Core | Version: | trunk |
| Severity: | normal | Keywords: | |
| Cc: |
Description
The Prototype javascript library (http://prototype.conio.net/) is unfortunately incompatible with the current Xinha. It's a great library for Ajax, and it's fully integrated with the Ruby on Rails framework. I wanted to use both in my Rails project, so I created this patch.
The Prototype library does some of its magic by extending the Object prototype, like so:
Object.prototype.extend = function(object) {
for (property in object) {
this[property] = object[property];
} return this;
}
This adds an 'extend' function to every object. Elegant for some things, but it can break existing apps when they try to loop over arrays, for instance. Xinha already has type checks in many places, but not everywhere, so this breaks Xinha. I've added some type checks in several places - now it works well, at least the editor shows and all the default buttons work as advertised. I'm attaching a patch against revision 258.
