Find the secrets to infinite income, and automate it!
7 Nov
A few days ago I posted about a FireFox bug that affected Function.prototype in the Chrome environment. The two modified prototype libraries that I posted were starting to get a little outdated. I spent the night modifying the most recent version of Prototype 1.6.0_rc1 framework to work in Chrome. I have also removed as many references as I could find to browsers other then Mozilla/Gecko. If you find any bugs or make any changes, please let me know so I can update the posted code.
WARNING: I have not fully tested this library!
Disclaimer: This modified version of the Prototye JavaScript framework is in no way affiliated, distributed or supported by Sam Stephenson or the Prototype library project. This library has been modified from its original intended version/use and I take no responsibility for any bugs, damages or problems this library may cause.
12 Responses for "Prototype XUL JavaScript Framework 1.6.0_rc1"
This is great! I’ve been using the 1.4 version for some time and haven’t been too thrilled with it. I’m glad to see you took the time to do this. Thanks a bunch.
Thanks for the support! Unfortunately the day after I released this, 1.6.0 final came out. I will hopefully port the new version over within the next week.
My biggest gripe is not being able to use Ajax requests sucessfully… do you know why something like this wont work?
new Ajax.Updater(content.document.getElementsByTagName(’body’)[0],’http://slashdot.org/’);
When I use the traditionall XMLHttpRequest object, it works. It seems to fail around line 1468 (Ajax.Updater).
As I mentioned, the library wasnt fully tested. If there are any JS errors thrown from Prototype, its most likely something I missed (I will test the Updater in a little). I would make sure that content.document.getElementsByTagName(’body’)[0] is a valid node. Selecting nodes and elements in Chrome can sometimes be a little tricky.
Yeah it should be a valid node. I had the same problem with the 1.4 version that was ported a while back. I tried fixing it but.. wow what a headache :). Here’s an example: http://cornsyrup.org/~larry/testextension/content/init.js
I made a sample xpi here: http://cornsyrup.org/~larry/testextension.xpi
Cheers,
Larry
Sorry I didnt see your post. It got stuck in the moderator queue. Yea, you are right, the body is loading. Im working on converting the new version of prototype today/tomorrow, so I will address those Ajax issues. As a side note, there are better ways to access the document object. Your way will run that function for every frame/iframe and also wont target tabs that load behind the “top” level window. document.XXX is only accessing the top window. A better way to access the document so you can keep taps on the tabs is like this:
function onPageLoad(event) {
if (event.originalTarget instanceof HTMLDocument) {
var doc = event.originalTarget;
if (event.originalTarget.defaultView.frameElement) {
//return; // Put this here if you dont want to run this function again for Frames/IFrame
} else {
doc.getElementsByTagName('body')[0];
[...]
}
}
}
Ah, this is great! Thanks a lot!
As another side note… you dont need to access body by tag name… You can do document.body or for my example doc.body.
Adam, do you have a 1.6.0 final version (in any state of untested)? I’ll diff your version to the original rc1 in the meantime and start playing with it.
Thanks,
Sean
@Sean
I know I promised to get on the 1.6 final. I have been days away from launching a new product, so all of my time is focused on that. If your diff-changes work out I will be happy to post it here. If not I will try and get to making a new version over the weekend or early next week.
Thanks!
now that, the prototype 1.6 has been released, can you please update the library to final version? i wish to use it in a project of mine.
thanks
Newest version of the library can be found at: http://www.adamgotterer.com/2008/02/19/prototype-xul-javascript-framework-1602/
Leave a reply