You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Roland Huss (JIRA)" <de...@myfaces.apache.org> on 2005/11/23 17:24:36 UTC

[jira] Created: (MYFACES-870) IE6: NPE in JavaScript when using

IE6: NPE in JavaScript when using <t:calendarInput>
---------------------------------------------------

         Key: MYFACES-870
         URL: http://issues.apache.org/jira/browse/MYFACES-870
     Project: MyFaces
        Type: Bug
    Versions: 1.1.1    
 Environment: Windows XP SP2
IE6
    Reporter: Roland Huss


This Javascript error occurs in 

 do {
                aTag = aTag.offsetParent;
                leftpos += aTag.offsetLeft;
                toppos += aTag.offsetTop;
        } while(aTag.tagName!="BODY");

when offsetParent is null. This seems to occur on occasion in IE (e.g. within a div with absolute positioning). 
The same problem is described in TAPESTRY-173 and TAPESTRY-222.

A similar problems occurs at

 while(objParent.tagName.toUpperCase() != "BODY" ){
        objLeft  += objParent.offsetLeft;
        objTop   += objParent.offsetTop;
        objParent = objParent.offsetParent;
      }

Again, offsetParent can be null in IE6. An additional condition in the while loop prevents this gotcha.

These problems doesn't occur on firefox 1.0.x

My temporary solution is to catch the NPE and simply ignore it. 


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Reopened: (MYFACES-870) IE6: NPE in JavaScript when using

Posted by "Bruno Aranda (JIRA)" <de...@myfaces.apache.org>.
     [ http://issues.apache.org/jira/browse/MYFACES-870?page=all ]
     
Bruno Aranda reopened MYFACES-870:
----------------------------------


True, sorry for that. Somewat it was lost (in my old file or in my mind). I will put it again right now

> IE6: NPE in JavaScript when using <t:calendarInput>
> ---------------------------------------------------
>
>          Key: MYFACES-870
>          URL: http://issues.apache.org/jira/browse/MYFACES-870
>      Project: MyFaces
>         Type: Bug
>     Versions: 1.1.1
>  Environment: Windows XP SP2
> IE6
>     Reporter: Roland Huss
>     Assignee: Bruno Aranda
>      Fix For: Nightly

>
> This Javascript error occurs in 
>  do {
>                 aTag = aTag.offsetParent;
>                 leftpos += aTag.offsetLeft;
>                 toppos += aTag.offsetTop;
>         } while(aTag.tagName!="BODY");
> when offsetParent is null. This seems to occur on occasion in IE (e.g. within a div with absolute positioning). 
> The same problem is described in TAPESTRY-173 and TAPESTRY-222.
> A similar problems occurs at
>  while(objParent.tagName.toUpperCase() != "BODY" ){
>         objLeft  += objParent.offsetLeft;
>         objTop   += objParent.offsetTop;
>         objParent = objParent.offsetParent;
>       }
> Again, offsetParent can be null in IE6. An additional condition in the while loop prevents this gotcha.
> These problems doesn't occur on firefox 1.0.x
> My temporary solution is to catch the NPE and simply ignore it. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Closed: (MYFACES-870) IE6: NPE in JavaScript when using

Posted by "Bruno Aranda (JIRA)" <de...@myfaces.apache.org>.
     [ http://issues.apache.org/jira/browse/MYFACES-870?page=all ]
     
Bruno Aranda closed MYFACES-870:
--------------------------------

    Fix Version: Nightly
     Resolution: Fixed

I've fixed that in the sources following your solution. Thanks Roland! I cannot try it since I only have a linux box here, but the fix seems harmless. Report back if it is not fixed and in that case I would reopen the issue,

> IE6: NPE in JavaScript when using <t:calendarInput>
> ---------------------------------------------------
>
>          Key: MYFACES-870
>          URL: http://issues.apache.org/jira/browse/MYFACES-870
>      Project: MyFaces
>         Type: Bug
>     Versions: 1.1.1
>  Environment: Windows XP SP2
> IE6
>     Reporter: Roland Huss
>     Assignee: Bruno Aranda
>      Fix For: Nightly

>
> This Javascript error occurs in 
>  do {
>                 aTag = aTag.offsetParent;
>                 leftpos += aTag.offsetLeft;
>                 toppos += aTag.offsetTop;
>         } while(aTag.tagName!="BODY");
> when offsetParent is null. This seems to occur on occasion in IE (e.g. within a div with absolute positioning). 
> The same problem is described in TAPESTRY-173 and TAPESTRY-222.
> A similar problems occurs at
>  while(objParent.tagName.toUpperCase() != "BODY" ){
>         objLeft  += objParent.offsetLeft;
>         objTop   += objParent.offsetTop;
>         objParent = objParent.offsetParent;
>       }
> Again, offsetParent can be null in IE6. An additional condition in the while loop prevents this gotcha.
> These problems doesn't occur on firefox 1.0.x
> My temporary solution is to catch the NPE and simply ignore it. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (MYFACES-870) IE6: NPE in JavaScript when using

Posted by "Volker Weber (JIRA)" <de...@myfaces.apache.org>.
    [ http://issues.apache.org/jira/browse/MYFACES-870?page=comments#action_12358473 ] 

Volker Weber commented on MYFACES-870:
--------------------------------------

Bruno,

you had missing a closing catch statement. Diff follows


Index: tomahawk/src/java/org/apache/myfaces/custom/calendar/resource/popcalendar.js
===================================================================
--- tomahawk/src/java/org/apache/myfaces/custom/calendar/resource/popcalendar.js        (Revision 348769)
+++ tomahawk/src/java/org/apache/myfaces/custom/calendar/resource/popcalendar.js        (Arbeitskopie)
@@ -544,6 +544,9 @@
                        topScrollOffset += aTag.scrollTop;
                        aTag = aTag.parentNode;
                } while(aTag.tagName!="BODY");
+       } catch (ex) {
+       // ignore
+    }

        var bodyRect = getVisibleBodyRectangle();
        var cal = document.getElementById("calendar");


> IE6: NPE in JavaScript when using <t:calendarInput>
> ---------------------------------------------------
>
>          Key: MYFACES-870
>          URL: http://issues.apache.org/jira/browse/MYFACES-870
>      Project: MyFaces
>         Type: Bug
>     Versions: 1.1.1
>  Environment: Windows XP SP2
> IE6
>     Reporter: Roland Huss
>     Assignee: Bruno Aranda
>      Fix For: Nightly

>
> This Javascript error occurs in 
>  do {
>                 aTag = aTag.offsetParent;
>                 leftpos += aTag.offsetLeft;
>                 toppos += aTag.offsetTop;
>         } while(aTag.tagName!="BODY");
> when offsetParent is null. This seems to occur on occasion in IE (e.g. within a div with absolute positioning). 
> The same problem is described in TAPESTRY-173 and TAPESTRY-222.
> A similar problems occurs at
>  while(objParent.tagName.toUpperCase() != "BODY" ){
>         objLeft  += objParent.offsetLeft;
>         objTop   += objParent.offsetTop;
>         objParent = objParent.offsetParent;
>       }
> Again, offsetParent can be null in IE6. An additional condition in the while loop prevents this gotcha.
> These problems doesn't occur on firefox 1.0.x
> My temporary solution is to catch the NPE and simply ignore it. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (MYFACES-870) IE6: NPE in JavaScript when using

Posted by "Roland Huss (JIRA)" <de...@myfaces.apache.org>.
    [ http://issues.apache.org/jira/browse/MYFACES-870?page=comments#action_12359145 ] 

Roland Huss commented on MYFACES-870:
-------------------------------------

Something seemed to went wrong again:

In popcalendar.js (revision 351688) the offset calculation is performed twice, one with try-catch, the other one-without:

function jscalendarHideElement( elmID, overDiv ){
     [...]
 
      // Find the element's offsetTop and offsetLeft relative to the BODY tag.
      objLeft   = obj.offsetLeft;
      objTop    = obj.offsetTop;
      objParent = obj.offsetParent;

      while( objParent.tagName.toUpperCase() != "BODY" ){
        objLeft  += objParent.offsetLeft;
        objTop   += objParent.offsetTop;
        objParent = objParent.offsetParent;
      }

      objParent = obj.offsetParent;

      // added a try-catch to the next loop (MYFACES-870)
      try {
              while( objParent.tagName.toUpperCase() != "BODY" ){
                objLeft  -= objParent.scrollLeft;
                objTop   -= objParent.scrollTop;
                objParent = objParent.parentNode;
         }
      } catch (ex) {
          // ignore
      }
      
     ...
}


You should remove the one without try-catch.....

> IE6: NPE in JavaScript when using <t:calendarInput>
> ---------------------------------------------------
>
>          Key: MYFACES-870
>          URL: http://issues.apache.org/jira/browse/MYFACES-870
>      Project: MyFaces
>         Type: Bug
>     Versions: 1.1.1
>  Environment: Windows XP SP2
> IE6
>     Reporter: Roland Huss
>     Assignee: Bruno Aranda
>      Fix For: Nightly

>
> This Javascript error occurs in 
>  do {
>                 aTag = aTag.offsetParent;
>                 leftpos += aTag.offsetLeft;
>                 toppos += aTag.offsetTop;
>         } while(aTag.tagName!="BODY");
> when offsetParent is null. This seems to occur on occasion in IE (e.g. within a div with absolute positioning). 
> The same problem is described in TAPESTRY-173 and TAPESTRY-222.
> A similar problems occurs at
>  while(objParent.tagName.toUpperCase() != "BODY" ){
>         objLeft  += objParent.offsetLeft;
>         objTop   += objParent.offsetTop;
>         objParent = objParent.offsetParent;
>       }
> Again, offsetParent can be null in IE6. An additional condition in the while loop prevents this gotcha.
> These problems doesn't occur on firefox 1.0.x
> My temporary solution is to catch the NPE and simply ignore it. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Closed: (MYFACES-870) IE6: NPE in JavaScript when using

Posted by "Martin Marinschek (JIRA)" <de...@myfaces.apache.org>.
     [ http://issues.apache.org/jira/browse/MYFACES-870?page=all ]
     
Martin Marinschek closed MYFACES-870:
-------------------------------------

    Resolution: Fixed

I have tested the current SVN head version in IE and it works. Thanks again, Roland, thanks Bruno!

> IE6: NPE in JavaScript when using <t:calendarInput>
> ---------------------------------------------------
>
>          Key: MYFACES-870
>          URL: http://issues.apache.org/jira/browse/MYFACES-870
>      Project: MyFaces
>         Type: Bug
>     Versions: 1.1.1
>  Environment: Windows XP SP2
> IE6
>     Reporter: Roland Huss
>     Assignee: Bruno Aranda
>      Fix For: Nightly

>
> This Javascript error occurs in 
>  do {
>                 aTag = aTag.offsetParent;
>                 leftpos += aTag.offsetLeft;
>                 toppos += aTag.offsetTop;
>         } while(aTag.tagName!="BODY");
> when offsetParent is null. This seems to occur on occasion in IE (e.g. within a div with absolute positioning). 
> The same problem is described in TAPESTRY-173 and TAPESTRY-222.
> A similar problems occurs at
>  while(objParent.tagName.toUpperCase() != "BODY" ){
>         objLeft  += objParent.offsetLeft;
>         objTop   += objParent.offsetTop;
>         objParent = objParent.offsetParent;
>       }
> Again, offsetParent can be null in IE6. An additional condition in the while loop prevents this gotcha.
> These problems doesn't occur on firefox 1.0.x
> My temporary solution is to catch the NPE and simply ignore it. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Closed: (MYFACES-870) IE6: NPE in JavaScript when using

Posted by "Bruno Aranda (JIRA)" <de...@myfaces.apache.org>.
     [ http://issues.apache.org/jira/browse/MYFACES-870?page=all ]
     
Bruno Aranda closed MYFACES-870:
--------------------------------

    Resolution: Fixed

Closing it again, the fix is in the svn. Thanks Volker!

> IE6: NPE in JavaScript when using <t:calendarInput>
> ---------------------------------------------------
>
>          Key: MYFACES-870
>          URL: http://issues.apache.org/jira/browse/MYFACES-870
>      Project: MyFaces
>         Type: Bug
>     Versions: 1.1.1
>  Environment: Windows XP SP2
> IE6
>     Reporter: Roland Huss
>     Assignee: Bruno Aranda
>      Fix For: Nightly

>
> This Javascript error occurs in 
>  do {
>                 aTag = aTag.offsetParent;
>                 leftpos += aTag.offsetLeft;
>                 toppos += aTag.offsetTop;
>         } while(aTag.tagName!="BODY");
> when offsetParent is null. This seems to occur on occasion in IE (e.g. within a div with absolute positioning). 
> The same problem is described in TAPESTRY-173 and TAPESTRY-222.
> A similar problems occurs at
>  while(objParent.tagName.toUpperCase() != "BODY" ){
>         objLeft  += objParent.offsetLeft;
>         objTop   += objParent.offsetTop;
>         objParent = objParent.offsetParent;
>       }
> Again, offsetParent can be null in IE6. An additional condition in the while loop prevents this gotcha.
> These problems doesn't occur on firefox 1.0.x
> My temporary solution is to catch the NPE and simply ignore it. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (MYFACES-870) IE6: NPE in JavaScript when using

Posted by "Bruno Aranda (JIRA)" <de...@myfaces.apache.org>.
    [ http://issues.apache.org/jira/browse/MYFACES-870?page=comments#action_12359172 ] 

Bruno Aranda commented on MYFACES-870:
--------------------------------------

Well, I removed the loop and tested the component (only in firefox, I am on a linux box) and it seems to work ok. Could you, or someone else, try it in IE6 and report back? Thanks Roland,

> IE6: NPE in JavaScript when using <t:calendarInput>
> ---------------------------------------------------
>
>          Key: MYFACES-870
>          URL: http://issues.apache.org/jira/browse/MYFACES-870
>      Project: MyFaces
>         Type: Bug
>     Versions: 1.1.1
>  Environment: Windows XP SP2
> IE6
>     Reporter: Roland Huss
>     Assignee: Bruno Aranda
>      Fix For: Nightly

>
> This Javascript error occurs in 
>  do {
>                 aTag = aTag.offsetParent;
>                 leftpos += aTag.offsetLeft;
>                 toppos += aTag.offsetTop;
>         } while(aTag.tagName!="BODY");
> when offsetParent is null. This seems to occur on occasion in IE (e.g. within a div with absolute positioning). 
> The same problem is described in TAPESTRY-173 and TAPESTRY-222.
> A similar problems occurs at
>  while(objParent.tagName.toUpperCase() != "BODY" ){
>         objLeft  += objParent.offsetLeft;
>         objTop   += objParent.offsetTop;
>         objParent = objParent.offsetParent;
>       }
> Again, offsetParent can be null in IE6. An additional condition in the while loop prevents this gotcha.
> These problems doesn't occur on firefox 1.0.x
> My temporary solution is to catch the NPE and simply ignore it. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Reopened: (MYFACES-870) IE6: NPE in JavaScript when using

Posted by "Bruno Aranda (JIRA)" <de...@myfaces.apache.org>.
     [ http://issues.apache.org/jira/browse/MYFACES-870?page=all ]
     
Bruno Aranda reopened MYFACES-870:
----------------------------------


> IE6: NPE in JavaScript when using <t:calendarInput>
> ---------------------------------------------------
>
>          Key: MYFACES-870
>          URL: http://issues.apache.org/jira/browse/MYFACES-870
>      Project: MyFaces
>         Type: Bug
>     Versions: 1.1.1
>  Environment: Windows XP SP2
> IE6
>     Reporter: Roland Huss
>     Assignee: Bruno Aranda
>      Fix For: Nightly

>
> This Javascript error occurs in 
>  do {
>                 aTag = aTag.offsetParent;
>                 leftpos += aTag.offsetLeft;
>                 toppos += aTag.offsetTop;
>         } while(aTag.tagName!="BODY");
> when offsetParent is null. This seems to occur on occasion in IE (e.g. within a div with absolute positioning). 
> The same problem is described in TAPESTRY-173 and TAPESTRY-222.
> A similar problems occurs at
>  while(objParent.tagName.toUpperCase() != "BODY" ){
>         objLeft  += objParent.offsetLeft;
>         objTop   += objParent.offsetTop;
>         objParent = objParent.offsetParent;
>       }
> Again, offsetParent can be null in IE6. An additional condition in the while loop prevents this gotcha.
> These problems doesn't occur on firefox 1.0.x
> My temporary solution is to catch the NPE and simply ignore it. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira