Skip to main content

Bug Tracker

Side navigation

#1149 closed bug (wontfix)

Opened April 28, 2007 06:54PM UTC

Closed March 31, 2008 01:36AM UTC

offsetParent exception in MSIE

Reported by: offwhite Owned by: stefan
Priority: major Milestone: 1.1.3
Component: interface Version: 1.1.2
Keywords: Cc:
Blocked by: Blocking:
Description

There is a bug in IE when using offsetParent. It is explained at the link below. I came across this problem and was able to work around the problem with a try/catch block as shown in the code below.

Is there another way to this? I noticed there are no try/catch blocks in the rest of the code. Is there a reason to avoid them?

Error explained:

http://weblogs.asp.net/rajbk/archive/2006/11/29/ie-6-7-unspecified-error-when-accessing-offsetparent-javascript.aspx

getPositionLite : function(el)

{

var x = 0, y = 0;

while(el) {

x += el.offsetLeft || 0;

y += el.offsetTop || 0;

try {

el = el.offsetParent;

}

catch (e) {

el = null;

}

}

return {x:x, y:y};

},

Attachments (0)
Change History (3)

Changed April 28, 2007 06:56PM UTC by offwhite comment:1

http://interface.eyecon.ro/

BTW, this is for the Interface Elements plugin. The documentation directed me to submit the bug here.

Changed April 29, 2007 02:30AM UTC by brandon comment:2

component: coreinterface
owner: johnstefan

Changed March 31, 2008 01:36AM UTC by scott.gonzal comment:3

description: There is a bug in IE when using offsetParent. It is explained at the link below. I came across this problem and was able to work around the problem with a try/catch block as shown in the code below.\ \ Is there another way to this? I noticed there are no try/catch blocks in the rest of the code. Is there a reason to avoid them?\ \ Error explained:\ http://weblogs.asp.net/rajbk/archive/2006/11/29/ie-6-7-unspecified-error-when-accessing-offsetparent-javascript.aspx\ \ getPositionLite : function(el)\ {\ var x = 0, y = 0;\ while(el) {\ x += el.offsetLeft || 0;\ y += el.offsetTop || 0;\ try {\ el = el.offsetParent;\ }\ catch (e) {\ el = null;\ }\ }\ return {x:x, y:y};\ },\ There is a bug in IE when using offsetParent. It is explained at the link below. I came across this problem and was able to work around the problem with a try/catch block as shown in the code below. \ \ Is there another way to this? I noticed there are no try/catch blocks in the rest of the code. Is there a reason to avoid them? \ \ Error explained: \ http://weblogs.asp.net/rajbk/archive/2006/11/29/ie-6-7-unspecified-error-when-accessing-offsetparent-javascript.aspx \ \ getPositionLite : function(el) \ { \ var x = 0, y = 0; \ while(el) { \ x += el.offsetLeft || 0; \ y += el.offsetTop || 0; \ try { \ el = el.offsetParent; \ } \ catch (e) { \ el = null; \ } \ } \ return {x:x, y:y}; \ }, \
resolution: → wontfix
status: newclosed

Interface is no longer supported; consider switching to jQuery UI.