I was wondering whether anybody could please tell me why this is causing an error in IE (works in Firefox): $A(container.getElementsByTagName(''*'')).each( function(el) { Element.cleanWhitespace(el); }.bind(this)); What would be an alternative of achieving the same? Thank you Marco M. Jaeger | Url: http://mmjaeger.com <http://mmjaeger.com/> | E-mail: mail-yVS5avHIROZWk0Htik3J/w@public.gmane.org Do you need business consulting, webdesign or webhosting: please visit http://j-cons.com <http://j-cons.com/> or please contact me at mail-tqBp8EdZ1v6Xj1p+fO2waQ@public.gmane.org _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
On 5/24/06, Marco M. Jaeger <mail-yVS5avHIROZWk0Htik3J/w@public.gmane.org> wrote:> > > > I was wondering whether anybody could please tell me why this is causing an > error in IE (works in Firefox): > > $A(container.getElementsByTagName(''*'')).each( function(el) { > Element.cleanWhitespace(el); > }.bind(this)); > > What would be an alternative of achieving the same? >Could you try this : col = container.getElementsByTagName(''*''); len = col.length for(var i = 0 ; i < len ; i++) { Element.cleanWhitespace(col[i]); }
Hi Marco! I''ve seen this before (namely in your dialogs), and i simply hacked my way around it with a try/catch block with no content in the catch... try { Element.cleanWhitespace(el); } catch (e) {} I have no idea why this happens although I know I''ve seen several other people on the list report similar issues... I''ve just not had any time to research it. On 5/24/06, Nicolas Terray <nicolas.terray-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > On 5/24/06, Marco M. Jaeger <mail-yVS5avHIROZWk0Htik3J/w@public.gmane.org> wrote: > > > > > > > > I was wondering whether anybody could please tell me why this is causing > an > > error in IE (works in Firefox): > > > > $A(container.getElementsByTagName(''*'')).each( function(el) { > > Element.cleanWhitespace(el); > > }.bind(this)); > > > > What would be an alternative of achieving the same? > > > > Could you try this : > > col = container.getElementsByTagName(''*''); > len = col.length > for(var i = 0 ; i < len ; i++) { > Element.cleanWhitespace(col[i]); > } > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
I''ll give that a try - thanks -----Original Message----- From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Ryan Gahl Sent: Wednesday, May 24, 2006 3:44 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: Re: [Rails-spinoffs] enumerables problem? Hi Marco! I''ve seen this before (namely in your dialogs), and i simply hacked my way around it with a try/catch block with no content in the catch... try { Element.cleanWhitespace (el); } catch (e) {} I have no idea why this happens although I know I''ve seen several other people on the list report similar issues... I''ve just not had any time to research it. On 5/24/06, Nicolas Terray <nicolas.terray-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: On 5/24/06, Marco M. Jaeger <mail-yVS5avHIROZWk0Htik3J/w@public.gmane.org> wrote: > > > > I was wondering whether anybody could please tell me why this is causing an > error in IE (works in Firefox): > > $A(container.getElementsByTagName(''*'')).each( function(el) { > Element.cleanWhitespace(el); > }.bind(this)); > > What would be an alternative of achieving the same? > Could you try this : col = container.getElementsByTagName(''*''); len = col.length for(var i = 0 ; i < len ; i++) { Element.cleanWhitespace(col[i]); } _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
I think the problem is the .bind(this). You aren''t referencing ''this'' in the function, what are you binding? I''d say drop it and see if it fixes it. Greg ________________________________ From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Marco M. Jaeger Sent: Wednesday, May 24, 2006 5:42 AM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: [Rails-spinoffs] enumerables problem? I was wondering whether anybody could please tell me why this is causing an error in IE (works in Firefox): $A(container.getElementsByTagName(''*'')).each( function(el) { Element.cleanWhitespace(el); }.bind(this)); What would be an alternative of achieving the same? Thank you Marco M. Jaeger | Url: http://mmjaeger.com <http://mmjaeger.com/> | E-mail: mail-yVS5avHIROZWk0Htik3J/w@public.gmane.org Do you need business consulting, webdesign or webhosting: please visit http://j-cons.com <http://j-cons.com/> or please contact me at mail-tqBp8EdZ1v6Xj1p+fO2waQ@public.gmane.org _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Marco and I have been emailing about this and I finally found the fix, so here it is. Feel free to pass it along to Sam, if he even responds to bug reports any more: In prototype.js, change line 998 From: Element.remove(node); To: node.parentNode.removeChild(node); Element.remove calls $(), which calls Element.extend. In Element.extend, when it says element._extended = true;, it dies in IE on text nodes (element.nodeType == 3). Since we don''t really care to extend the node just to remove it, we should not even care about appending all of the extra functions to the node. Another option is to put a conditional in $() that just returns the element if it has a nodeType of 3, but I suppose there might be some weird case where you actually want to add extra functions to text nodes (I can''t think of any at the moment, though). Greg ________________________________ From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Gregory Hill Sent: Wednesday, May 24, 2006 8:28 AM To: mail-yVS5avHIROZWk0Htik3J/w@public.gmane.org; rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails-spinoffs] enumerables problem? I think the problem is the .bind(this). You aren''t referencing ''this'' in the function, what are you binding? I''d say drop it and see if it fixes it. Greg ________________________________ From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Marco M. Jaeger Sent: Wednesday, May 24, 2006 5:42 AM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: [Rails-spinoffs] enumerables problem? I was wondering whether anybody could please tell me why this is causing an error in IE (works in Firefox): $A(container.getElementsByTagName(''*'')).each( function(el) { Element.cleanWhitespace(el); }.bind(this)); What would be an alternative of achieving the same? Thank you Marco M. Jaeger | Url: http://mmjaeger.com <http://mmjaeger.com/> | E-mail: mail-yVS5avHIROZWk0Htik3J/w@public.gmane.org Do you need business consulting, webdesign or webhosting: please visit http://j-cons.com <http://j-cons.com/> or please contact me at mail-tqBp8EdZ1v6Xj1p+fO2waQ@public.gmane.org _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs