IE invalid calling object addMethods

407 views
Skip to first unread message

kstubs

unread,
Feb 26, 2012, 7:22:40 PM2/26/12
to prototype-s...@googlegroups.com
I'm getting the error "invalid calling object" when I try to addMethods to the tag SELECT.  Try this page in IE browser.  Any help would be appreciated... just released extensive code where I have extended the SELECT tag and there is no easy way to go back.

kstubs

unread,
Feb 26, 2012, 7:33:36 PM2/26/12
to prototype-s...@googlegroups.com
Just walked the code and it errors on this line in prototype-1.7

destination[property]

This is in the copy function of addMethods object.

kstubs

unread,
Feb 26, 2012, 9:19:09 PM2/26/12
to prototype-s...@googlegroups.com
I took the code down... I still hope some can shed light on this problem.

kstubs

unread,
Feb 27, 2012, 1:11:31 AM2/27/12
to prototype-s...@googlegroups.com
And I put it back up.  Here it is:

Please have a look.  This works great in Chrome and fails in IE.
Thanks,
Karl..

kstubs

unread,
Feb 27, 2012, 1:15:18 AM2/27/12
to prototype-s...@googlegroups.com
NOTE:  doesn't work in IE9, but seems to work in IE7, and IE8.
Did I mention how much I love IE?

Victor

unread,
Feb 27, 2012, 2:14:58 AM2/27/12
to prototype-s...@googlegroups.com
You shouldn't pass non-functions to Element.addMethods("SELECT", {}). You have fields like __ddObject in your _selectOptions - they are causing error while IE tries to methodize() them.

Victor

unread,
Feb 27, 2012, 2:17:02 AM2/27/12
to prototype-s...@googlegroups.com
NOTE:  doesn't work in IE9, but seems to work in IE7, and IE8.

This example doesn't work in FF 10 also.

Victor

unread,
Feb 27, 2012, 2:31:14 AM2/27/12
to prototype-s...@googlegroups.com
Whoops, I was wrong :)
The problem is in _selectOptions.size() - there is already property named `size` in HTMLSelectElement (at least both in IE and FF) and in cannot be overwritten properly.

kstubs

unread,
Feb 27, 2012, 11:09:48 AM2/27/12
to prototype-s...@googlegroups.com
That's it!  Thank you Victor.  I've changed size to count.
I'm a little new to adding methods to elements so wasn't sure how or where to troubleshoot.

Thanks,
Karl..

Victor

unread,
Feb 29, 2012, 2:11:13 AM2/29/12
to prototype-s...@googlegroups.com
wasn't sure how or where to troubleshoot.


There is a debugger in IE8+ (opened by F12 key) - I've just traced a bit around the place where the error arises, and found strange behaviour of destination[property] for `size`, after that I've looked at https://developer.mozilla.org/en/DOM/HTMLSelectElement and http://msdn.microsoft.com/en-us/library/dd347116%28v=vs.85%29.aspx - and the cause was clear.

kstubs

unread,
Mar 4, 2012, 8:03:21 PM3/4/12
to prototype-s...@googlegroups.com
Thanks for the tip Victor.  I do try to decode with IE, and I am using IETester, but my primary box is IE9, so it is a bit tricky.  I suppose if I didn't have all your help I'd be forced to undust and old machine!

Karl..

Victor

unread,
Mar 5, 2012, 12:45:54 PM3/5/12
to prototype-s...@googlegroups.com

Thanks for the tip Victor.  I do try to decode with IE, and I am using IETester, but my primary box is IE9, so it is a bit tricky.  I suppose if I didn't have all your help I'd be forced to undust and old machine!

I use Vista + IE8 + latest IE9 platform preview + IETester (with IE6...IE8 and IE9 platform preview)
Reply all
Reply to author
Forward
0 new messages