-
28 Feb 2008 3:27 AM #1
[2.0.2][OPEN] prototype + prototype-adapter problems in IE
[2.0.2][OPEN] prototype + prototype-adapter problems in IE
I have changed
toCode:<!-- LIBS --> <script type="text/javascript" src="../../adapter/ext/ext-base.js"></script> <!-- ENDLIBS -->
in absform.html example. It works fine with FF. If I open this example in IE7 and then press 'refresh' button I will get 'object required' error.Code:<!-- LIBS --> <script type="text/javascript" src="../../adapter/prototype/prototype.js"></script> <script type="text/javascript" src="../../adapter/prototype/ext-prototype-adapter.js"></script> <!-- ENDLIBS -->
This error can be tracked down to prototype.js script line 3777 in my case.
The node object is null. event.type is "unload".Code:element: function(event) { var node = Event.extend(event).target; --> return Element.extend(node.nodeType == Node.TEXT_NODE ? node.parentNode : node); },
-
2 Mar 2008 12:36 AM #2
Thanks, we'll take a look at it.
-
2 Mar 2008 8:52 AM #3
Unfortunately, we can't make adjustments to the prototype library. You may wish inform them of the bug in their bug tracker and see if they can get whatever the error is corrected.
-
5 Mar 2008 9:06 AM #4
re: prototype + prototype-adapter problems in IE
re: prototype + prototype-adapter problems in IE
Unfortunately, I am having this same '3777' error.
So based on your response Jack you're saying that even though our pages work completely fine using prototype 1.6 without referencing the ext library that the problem is with the prototype library?
-
10 Mar 2008 12:19 PM #5
I also get this error. Prototype works fine on its own, and this error starts showing up when I add in Ext. The error seems to come from Prototype's assumption that events in IE have a non-null "srcElement" property, which does not seem to be the case for events thrown by Ext.
I was able to fix this by editing ext-prototype-adapter.js and changing Ext.lib.Event.getTarget as follows:
The following also works, but only if every event object passing through the function has beenCode:getTarget : function(e){ e = (e.browserEvent || e); return (e.target || e.srcElement); },
pre-extended by Prototype, which I'm not confident about.
There may be a better solution, but that one gets me past the error message for the time being.Code:return (e.browserEvent || e).target;
It seems to me that the Prototype adapter in general hasn't been well updated to reflect changes in Prototype 1.6, especially Prototype's new practice of extending the event object itself. Many if the things with "missing from prototype?" comments are actually no longer missing from prototype as of version 1.6.
Specifically...
getViewportHeight/Width: not missing, see document.viewport.
getRelatedTarget: not missing, event object is extended with "relatedTarget" property if it's not already there.
preventDefault/stopPropagation: not missing, prototype adds these standard methods directly to the event object if they are not present.
getTarget: Prototype adds a standard "target" property to the event object if it is not already present - it should not be necessary to call Event.element() on any event that was subscribed to with Event.observe().
-
10 Mar 2008 12:31 PM #6
@jmueller: Since you obviously know the new Prototype version pretty well, if you'd like to provide a patched adapter, that would make it much easier for us to update it quickly. Of course we'll do it ourselves evetually, but it may take a little while for us to get to. With your help, we could get it patched much faster. Thanks for the info.
-
10 Mar 2008 2:12 PM #7
Brian,
Sure, here's the changes I've made, which aren't many:
I couldn't find the un-minified source for the line that begins "Ext={version:"2.0.2"}" but I made these changes to that code:
Ext.lib.Dom...Code:isOpera=Prototype.Browser.Opera,isSafari=Prototype.Browser.WebKit, isSafari3=isSafari&&ua.indexOf("webkit/5")!=-1,isIE=Prototype.Browser.IE, isIE7=isIE&&ua.indexOf("msie 7")>-1,isGecko=Prototype.Browser.GeckoExt.lib.Event...Code:getViewportHeight: function() { return document.viewport.getHeight(); }, getViewportWidth: function() { return document.viewport.getWidth(); },I left getRelatedTarget, preventDefault, and stopPropagation alone, because they will work as-is if the event object has been extended by Prototype, and I'm not confident that every event created/used by Ext will have been passed through Prototype for extension first. I've only been using Ext for 3 or 4 days. Anyway, feel free to use any of that code you like.Code:getTarget : function(e){ e = (e.browserEvent || e); return (e.target || e.srcElement); },
I don't think I'm going to have time to take the patch any further than that for a while. Ext seems to be hard-locking Firefox 2 and 3 for 3-5 seconds following the page load. But only in my application, not on the sample pages. It doesn't seem to matter if I use the Prototype adapter or ext-base.js, and it doesn't happen in IE. I'll be spending my time trying to isolate and solve that problem, because if I can't fix it, we probably won't be using Ext anyway.
-
18 Mar 2008 11:49 AM #8
Questiom about the code
Questiom about the code
As indicated in the code above, where is the following:
I couldn't find the un-minified source for the line that begins "Ext={version:"2.0.2"}" but I made these changes to that code:
Code:
isOpera=Prototype.Browser.Opera,isSafari=Prototype.Browser.WebKit,
isSafari3=isSafari&&ua.indexOf("webkit/5")!=-1,isIE=Prototype.Browser.IE,
isIE7=isIE&&ua.indexOf("msie 7")>-1,isGecko=Prototype.Browser.Gecko
I do not see that code in the bridge source anywhere which I would think is needed in order to make the changes as outlined above. I have had the same issues described above with IE6 specifically. It would be great if I could at least put these changes in place but we need to know where the version info and such is to be found in the bridge source.
Thanks
Ben
-
26 Mar 2008 3:17 PM #9
The original source you're looking for is in Ext.js. In the deployed copy of Ext, that code is built right into each adapter since it is required first for namespaces, etc.
I haven't yet had a chance to look into the Prototype changes, but it's still on our list.
-
21 Apr 2008 6:16 AM #10
FYI, here is the bug in Prototype's Trac for this issue:
http://dev.rubyonrails.org/ticket/10100
The bug is definitely a bug in prototype, and I think it is best handled through a prototype workaround/fix as opposed to Ext changes.
I mentioned a workaround to the problem (that probably ultimately contains the solution that should be applied to a future prototype release), and I'll include that workaround here for reference for those in the Ext community:
You need to include this javascript right after you include the prototype.js file (and before you include Ext).Code:Event.Methods.pointer = Event.pointer = function(event) { return { x: event.pageX || (event.clientX + (document.documentElement.scrollLeft || (document.body ? document.body.scrollLeft : 0))), y: event.pageY || (event.clientY + (document.documentElement.scrollTop || (document.body ? document.body.scrollTop : 0))) }; };


Reply With Quote