I
On Jul 17, 2013, at 3:37 PM, Joseph Lust wrote:

> Ran into this issue on Prototype 1.5.1 and IE8.

Is there a specific reason you are using such an old (years!) version of 
Prototype? 1.7.1 is current, and even it is getting a little long in the tooth.

> 
> The error is in the array without() function in IE8. without() should return 
> an empty array if the array sans element is empty, or the array with that 
> element removed.
> 
> In IE8, if there are no elements left in the array after the target element 
> is removed, undefined is returned, breaking anything chained after that.
> 
>   remove: function(classNameToRemove) {
>     if (!this.include(classNameToRemove)) return;
>     this.set($A(this).without(classNameToRemove).join(' '));
>   },

Are you trying to get an array of classnames from an element, or are you trying 
to remove a class from an element? Because there's the Element#removeClassName 
if the latter. It does pretty much what you do here, except it returns an 
extended element, not an array of strings. You could get the former with this:

        
$(this).removeClassName(classNameToRemove).className.toString().split(/\s+/);

Walter

> 
> The actual source was that without() internally uses each() to iterate across 
> the elements, but the DOMAssistant library have overwritten Element.each(). 
> The new version could not catch the breaks that are thrown by Prototype to 
> escape from deep nested iterators, and hence the error. Thus, the two libs 
> should not be used in conjunction. It seems that other browsers don't 
> overwrite the Element.each() method when loading the two libs like IE does.
> 
> 
> 
> Sincerely,
> Joseph
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Prototype & script.aculo.us" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to prototype-scriptaculous+unsubscr...@googlegroups.com.
> To post to this group, send email to prototype-scriptaculous@googlegroups.com.
> Visit this group at http://groups.google.com/group/prototype-scriptaculous.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to prototype-scriptaculous+unsubscr...@googlegroups.com.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
Visit this group at http://groups.google.com/group/prototype-scriptaculous.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to