Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Sencha User
    Join Date
    May 2011
    Posts
    3
    Vote Rating
    0
    redosk is on a distinguished road

      0  

    Default [4.0.1] [IE8] 'events' is null or not an object

    [4.0.1] [IE8] 'events' is null or not an object


    Hello,

    I have seen other people complaining about similar error with extjs 3.x :

    Using IE 8.0.7600.16385, extjs 4.0.1, in ext-all-debug.js :

    'events' is null or not an object
    Line: 10962
    Char: 9

    Here is the code corresponding :
    Code:
        getElementEventCache : function(element) {
            var elementCache = Ext.cache[this.getId(element)];
            return elementCache.events || (elementCache.events = {});
        },
    The bug happens everytime 30 seconds after the page has been loaded.
    The return line is where the error is triggered, after some debugging, it appears that sometimes elementCache is null !

    So, I tried modifying the getElementEventCache method like this :

    Code:
        getElementEventCache : function(element) {
            var elementCache = Ext.cache[this.getId(element)];
            if (elementCache==null) {
              return {};
            }
            return elementCache.events || (elementCache.events = {});
        },
    No more problem in this method but... now the error is at line 10856 :

    Code:
        removeAll : function(element){
            var dom = Ext.getDom(element),
                cache, ev;
            if (!dom) {
                return;
            }
            cache = this.getElementEventCache(dom);
    
            for (ev in cache) {
                if (cache.hasOwnProperty(ev)) {
                    this.removeListener(dom, ev);
                }
            }
            Ext.cache[dom.id].events = {}; // HERE IS THE ERROR
        }
    I patched it like this :
    Code:
            if (Ext.cache[dom.id] != null) {
                Ext.cache[dom.id].events = {};
            }
    It solved the problem here but in fact everywhere there is an access to Ext.cache[], it seems that some elements are not in this cache, triggering a null pointer bug...

    This bug is specific to IE (perhaps only IE8, I have not tested with another version), it doen not happen in Chrome nor FF.

    Here is a page where the error happens :
    HTML Code:
    <html>
    <head>
    <link rel="stylesheet" type="text/css" href="/ext-4.0.1/resources/css/ext-all.css" />
    <script type="text/javascript" src="/ext-4.0.1/builds/ext-core.js"></script>
    <script type="text/javascript" src="/ext-4.0.1/ext-all-debug.js"></script>
    <script language="JavaScript">
    Ext.onReady(function(){
      var tip = Ext.create('Ext.tip.ToolTip', {
        id: 'content-anchor-tip',
        target: 'tiaTable',
        anchor: 'left',
        anchorToTarget: true,
        maxWidth:332,
        minWidth:250,
        autoHide: false,
        closable: true,
        delegate: 'img[class=details]',
        contentEl: 'content-tip'
      });
    });
    </script>
    <style type="text/css">
      .details { cursor:pointer; }
    </style>
    </head>
    <body>
      <table id="tiaTable" border="1">
        <tr><td>blah1A<img class="details" src="icone_photos.gif"></td><td>blah1B</td><td>blah1C</td><td>blah1D</td></tr>
        <tr><td>blah2A<img class="details" src="icone_photos.gif"></td><td>blah2B</td><td>blah2C</td><td>blah2D</td></tr>
        <tr><td>blah3A<img class="details" src="icone_photos.gif"></td><td>blah3B</td><td>blah3C</td><td>blah3D</td></tr>
        <tr><td>blah4A<img class="details" src="icone_photos.gif"></td><td>blah4B</td><td>blah4C</td><td>blah4D</td></tr>
      </table>
      <div style="display:none;">
         <div id="content-tip" style="overflow:hidden">
           BLAH<br />BLAH<br />BLAH<br />BLAH<br />
         </div>
      </div>
    </body>
    </html>
    Last edited by redosk; 20 May 2011 at 7:41 AM. Reason: adding an example

  2. #2
    Sencha User
    Join Date
    Mar 2011
    Posts
    2
    Vote Rating
    0
    mmmoose68 is on a distinguished road

      0  

    Default same

    same


    I am having the exact same issue. Happens after about 25 seconds and can be chased around the extjs files.

  3. #3
    Sencha User Nom4d3's Avatar
    Join Date
    Sep 2008
    Location
    Araras / SP / Brazil
    Posts
    81
    Vote Rating
    1
    Nom4d3 is on a distinguished road

      0  

    Default


    Try to remove this line:

    <script type="text/javascript" src="/ext-4.0.1/builds/ext-core.js"></script>

    I was doing the same mistake
    ExtJS4 is not necessary to load the Ext-Core anymore. It worked for me.

  4. #4
    Sencha User
    Join Date
    Mar 2011
    Posts
    2
    Vote Rating
    0
    mmmoose68 is on a distinguished road

      0  

    Default fixed

    fixed


    I fixed mine by removing the include of bootstrap.js

  5. #5
    Sencha User
    Join Date
    Aug 2009
    Posts
    37
    Vote Rating
    1
    jsalisbury is on a distinguished road

      0  

    Default IE only, ‘events’ is null or not an object, after 30 seconds - WORKED FOR ME TOO, TXs

    IE only, ‘events’ is null or not an object, after 30 seconds - WORKED FOR ME TOO, TXs


    Commenting out ext-core.js fixed it for me too:
    <!--- script type="text/javascript" src="/ext-4.0.2/builds/ext-core.js"></script --->


    thank you so much for posting this solution, I was close to tears (again)!

    cheers,

  6. #6
    Ext JS Premium Member
    Join Date
    Mar 2011
    Posts
    36
    Vote Rating
    0
    Machiavelli79 is on a distinguished road

      0  

    Default


    Thx for posting

  7. #7
    Ext JS Premium Member
    Join Date
    Dec 2007
    Posts
    61
    Vote Rating
    0
    Shyru is on a distinguished road

      0  

    Default


    At first I was happy to find a solution to this problem, but I already do not include neither bootstrap nor ext-core in my page. I still get this error.
    Any other hints?

  8. #8
    Sencha User
    Join Date
    Feb 2011
    Posts
    3
    Vote Rating
    0
    doocontrol is on a distinguished road

      0  

    Default It's because the garbageCollect

    It's because the garbageCollect


    i debug this problem in visual studio .net debuger, and get the call stack:
    function garbageCollect()->Ext.EventManager.removeAll(d);
    removeAll : function(element)->cache = this.getElementEventCache(dom);
    getElementEventCache : function(element) ->return elementCache.events || (elementCache.events = {});

    but i cant solve it

  9. #9
    Sencha User
    Join Date
    Feb 2011
    Posts
    3
    Vote Rating
    0
    doocontrol is on a distinguished road

      0  

    Default



    i think i solve it. add this code:

    Code:
     
      if(Ext.isIE){
       Ext.enableGarbageCollector=false;
      }

  10. #10
    Sencha User
    Join Date
    Apr 2011
    Posts
    5
    Vote Rating
    0
    Maja is on a distinguished road

      0  

    Default


    Thanks doocontrol! I couldn't believe the problem was finally solved!