1. #1
    Ext User
    Join Date
    Feb 2008
    Posts
    3
    Vote Rating
    0
    Krotzzz is on a distinguished road

      0  

    Default [2.0.2][OPEN] prototype + prototype-adapter problems in IE

    [2.0.2][OPEN] prototype + prototype-adapter problems in IE


    I have changed

    Code:
        <!-- LIBS -->
        <script type="text/javascript" src="../../adapter/ext/ext-base.js"></script>
        <!-- ENDLIBS -->
    to

    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 -->
    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.
    This error can be tracked down to prototype.js script line 3777 in my case.

    Code:
        element: function(event) {
          var node = Event.extend(event).target;
    -->      return Element.extend(node.nodeType == Node.TEXT_NODE ? node.parentNode : node);
        },
    The node object is null. event.type is "unload".

  2. #2
    Sencha User
    Join Date
    Apr 2012
    Location
    Austin, Texas
    Posts
    4
    Vote Rating
    0
    brian.moeskau is an unknown quantity at this point

      0  

    Default


    Thanks, we'll take a look at it.

  3. #3
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    Tampa, FL
    Posts
    6,955
    Vote Rating
    17
    jack.slocum will become famous soon enough jack.slocum will become famous soon enough

      0  

    Default


    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.
    Jack Slocum
    Ext JS Founder
    Original author of Ext JS 1, 2 & 3.
    Twitter: @jackslocum
    jack@extjs.com

  4. #4
    Ext JS Premium Member
    Join Date
    Feb 2008
    Posts
    3
    Vote Rating
    0
    jtaylor179 is on a distinguished road

      0  

    Default 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?

  5. #5
    Ext User
    Join Date
    Mar 2008
    Posts
    16
    Vote Rating
    0
    jmueller is on a distinguished road

      0  

    Default


    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:

    Code:
        getTarget : function(e){
            e = (e.browserEvent || e);
            return (e.target || e.srcElement);
        },
    The following also works, but only if every event object passing through the function has been
    pre-extended by Prototype, which I'm not confident about.

    Code:
    return (e.browserEvent || e).target;
    There may be a better solution, but that one gets me past the error message for the time being.

    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().

  6. #6
    Sencha User
    Join Date
    Apr 2012
    Location
    Austin, Texas
    Posts
    4
    Vote Rating
    0
    brian.moeskau is an unknown quantity at this point

      0  

    Default


    @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.

  7. #7
    Ext User
    Join Date
    Mar 2008
    Posts
    16
    Vote Rating
    0
    jmueller is on a distinguished road

      0  

    Default


    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:

    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
    Ext.lib.Dom...
    Code:
        getViewportHeight: function() {
            return document.viewport.getHeight();
        },
    
        getViewportWidth: function() {
            return document.viewport.getWidth();
        },
    Ext.lib.Event...
    Code:
        getTarget : function(e){
            e = (e.browserEvent || e);
            return (e.target || e.srcElement);
        },
    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.

    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.

  8. #8
    Ext User
    Join Date
    Mar 2008
    Posts
    22
    Vote Rating
    0
    benb is on a distinguished road

      0  

    Default 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

  9. #9
    Sencha User
    Join Date
    Apr 2012
    Location
    Austin, Texas
    Posts
    4
    Vote Rating
    0
    brian.moeskau is an unknown quantity at this point

      0  

    Default


    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.

  10. #10
    Ext User
    Join Date
    Apr 2007
    Posts
    15
    Vote Rating
    0
    lenzb is on a distinguished road

      0  

    Default


    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:
    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)))
      };
    };
    You need to include this javascript right after you include the prototype.js file (and before you include Ext).