You found a bug! We've classified it as TOUCH-3612 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha Premium Member
    Join Date
    Jan 2008
    Location
    Switzerland, Malaysia, Indonesia
    Posts
    12
    Vote Rating
    0
    trancee is on a distinguished road

      0  

    Default [2.1.0-rc2] Function getPageBox in Element.position might throw JavaScript error

    [2.1.0-rc2] Function getPageBox in Element.position might throw JavaScript error


    We got some errors showing up in our logs that pointed to this piece of code in the src/dom/Element.position.js file:

    Code:
        getPageBox: function(getRegion) {
            var me = this,
                el = me.dom,
                w = el.offsetWidth,
                h = el.offsetHeight,
                xy = me.getXY(),
                t = xy[1],
                r = xy[0] + w,
                b = xy[1] + h,
                l = xy[0];
    
            if (!el) {
                return new Ext.util.Region();
            }
    ...
    Now, by looking at this code snippet above, the experienced coder should find out what could cause the "undefined" error. My guess is that someone was overly excited at optimizing code and just put all variables into the var region without checking.

    If el is undefined, this code will throw an error in the vars section. It is being checked later on, but it will never reach it anyway since the error would already have been thrown.

    Please change the code to show the following in order to fix this:

    Code:
        getPageBox: function(getRegion) {
            var me = this,
                el = me.dom;
    
            if (!el) {
                return new Ext.util.Region();
            }
    
            var w = el.offsetWidth,
                h = el.offsetHeight,
                xy = me.getXY(),
                t = xy[1],
                r = xy[0] + w,
                b = xy[1] + h,
                l = xy[0];
    ...
    I hope this will be fixed before the GA release. Thank you.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,620
    Vote Rating
    817
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Thanks for the report! I have opened a bug in our bug tracker.

Thread Participants: 1