IE invalid calling object addMethods

已查看 407 次
跳至第一个未读帖子

kstubs

未读,
2012年2月26日 19:22:402012/2/26
收件人 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

未读,
2012年2月26日 19:33:362012/2/26
收件人 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

未读,
2012年2月26日 21:19:092012/2/26
收件人 prototype-s...@googlegroups.com
I took the code down... I still hope some can shed light on this problem.

kstubs

未读,
2012年2月27日 01:11:312012/2/27
收件人 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

未读,
2012年2月27日 01:15:182012/2/27
收件人 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

未读,
2012年2月27日 02:14:582012/2/27
收件人 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

未读,
2012年2月27日 02:17:022012/2/27
收件人 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

未读,
2012年2月27日 02:31:142012/2/27
收件人 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

未读,
2012年2月27日 11:09:482012/2/27
收件人 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

未读,
2012年2月29日 02:11:132012/2/29
收件人 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

未读,
2012年3月4日 20:03:212012/3/4
收件人 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

未读,
2012年3月5日 12:45:542012/3/5
收件人 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)
回复全部
回复作者
转发
0 个新帖子