oximore-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jan-04 16:05 UTC
Bug with IE 6 (maybe 7, but dn''t know)
Hello, I''ve noticed that when you put a '','' at the end of the last effect, IE doesn''t work. EX: new Effect.Parallel( [ new Effect.SlideDown(id,{duration:0.1}), new Effect.Opacity(id, {duration: 0.8, from: 0.0, to:1.0}) ], {duration: 1.0}); works perfectly, but new Effect.Parallel( [ new Effect.SlideDown(id,{duration:0.1}), new Effect.Opacity(id, {duration: 0.8, from: 0.0, to:1.0}), ], {duration: 1.0}); doesn''t work on IE 6. Oximore --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
oximore-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> Hello, > > I''ve noticed that when you put a '','' at the end of the last effect, IE > doesn''t work.It doesn''t work because it''s not really correct. Firefox allows it which is frankly a pain because you won''t catch the mistake unless you fire up IE. I admit that it''s a pain since other languages allow the extra comma (Perl) and you just get used to it. -- Michael Peters Developer Plus Three, LP --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Michael Peters wrote:> oximore-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: > > Hello, > > > > I''ve noticed that when you put a '','' at the end of the last effect, IE > > doesn''t work. > > It doesn''t work because it''s not really correct.Not correct in what way? It is legal ECMAScript syntax, however it is interpreted incorrectly by IE which will add an extra element to the array. Therefore it may be "not correct" because Effect.Parallel expects all elements in the array to have been assigned a value.> Firefox allows itBecause Firefox follows the ECMAScript specification. A trailing comma in an Array literal should not create an extra element, however in IE it will create an extra element with an unassigned value. e.g.: var x = [,,,]; alert(x.length); // shows 3 in Firefox, 4 in IE. Firefox is correct, IE is wrong.> which is > frankly a pain because you won''t catch the mistake unless you fire up IE.Should Firefox use a non-compliant implementation and mimic IE''s bugs just to save developers having to properly test their code? You could equally criticise the Effect class for not checking the values passed to it.> I > admit that it''s a pain since other languages allow the extra comma (Perl) and > you just get used to it.In this regard, ECMAScript is consistent with those "other languages" - it is IE''s flawed implementation of the specification that is the difference. -- Rob --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
RobG wrote:> Michael Peters wrote: > > oximore-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: > > > Hello, > > > > > > I''ve noticed that when you put a '','' at the end of the last effect, IE > > > doesn''t work. > > > > It doesn''t work because it''s not really correct. > > Not correct in what way? It is legal ECMAScript syntax, however it is > interpreted incorrectly by IE which will add an extra element to the > array. Therefore it may be "not correct" because Effect.Parallel > expects all elements in the array to have been assigned a value. > > > Firefox allows it > > Because Firefox follows the ECMAScript specification. A trailing comma > in an Array literal should not create an extra element, however in IE > it will create an extra element with an unassigned value.I''ll correct that. IE increments the length, which is still incorrect and within a for loop is equivalent to adding an element with value ''undefined''. It should only increment the length for elisions that aren''t at the end of the element list. e.g. var x = [ 1, ,2 ]; // length = 3; var x = [ 1, 2, ]; // length = 2; IE will give a length of 3 for both. As a bit of trivia, if a for..in loop is used, IE will get it right since there is no element with index 3. :-) -- Rob --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
RobG wrote:> > Michael Peters wrote: >> oximore-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: >> > Hello, >> > >> > I''ve noticed that when you put a '','' at the end of the last effect, IE >> > doesn''t work. >> >> It doesn''t work because it''s not really correct. > > Not correct in what way? It is legal ECMAScript syntax, however it is > interpreted incorrectly by IE which will add an extra element to the > array. Therefore it may be "not correct" because Effect.Parallel > expects all elements in the array to have been assigned a value.I''m sorry, I was a little confused. I thought you were talking about trailing commas in object literals. { stuff : ''foo'', more : ''bar'', } Am I mistaken, or are those allowed too?> In this regard, ECMAScript is consistent with those "other languages" - > it is IE''s flawed implementation of the specification that is the > difference.I''m not trying to defend IE or say that other browsers should break conformance with the spec to accomodate MS. I was just mistaken. Sorry for the confusion. -- Michael Peters Developer Plus Three, LP --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Michael Peters wrote:> RobG wrote: > > > > Michael Peters wrote: > >> oximore-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: > >> > Hello, > >> > > >> > I''ve noticed that when you put a '','' at the end of the last effect, IE > >> > doesn''t work. > >> > >> It doesn''t work because it''s not really correct. > > > > Not correct in what way? It is legal ECMAScript syntax, however it is > > interpreted incorrectly by IE which will add an extra element to the > > array. Therefore it may be "not correct" because Effect.Parallel > > expects all elements in the array to have been assigned a value. > > I''m sorry, I was a little confused. I thought you were talking about trailing > commas in object literals. > > { > stuff : ''foo'', > more : ''bar'', > } > > Am I mistaken, or are those allowed too?Elisions (empty elements) aren''t allowed in object literals. However, I recall someone suggesting trailing commas in object literals be tolerated and not throw an error as a proposal for JavaScript 2.0, though I can''t find a reference for it right now. The purpose of elisions in Array literals is to provide a short-cut method of incrementing the length without creating empty elements, e.g.: var x = []; x[2] = ''foo''; should be identical to: var x = [ ,,''foo'' ]; That is, an array with length 3 and a single element at index 2. IE gets this example right, however there is a known bug in Gecko browsers where elisions not at the end are created as elements and given the value ''undefined''. In Firefox the second example above creates an array with length 3, elements at index 0 and 1 with value ''undefined'' and at index 2 with value ''foo''. With trailing elisions, the last one should have no effect: Gecko gets that bit right, but IE doesn''t: var x = [ ''foo'',, ]; Should result in x having a length of 2 and a single element ''foo'' at index 0. Firefox gets the length right but has an ''undefined'' element at index 1. IE correctly doesn''t add elided elements but gets the length wrong, setting it to 3.> > > In this regard, ECMAScript is consistent with those "other languages" - > > it is IE''s flawed implementation of the specification that is the > > difference. > > I''m not trying to defend IE or say that other browsers should break conformance > with the spec to accomodate MS. I was just mistaken. Sorry for the confusion.That''s OK. Probably the most ECMAScript compliant browser is Opera. When using a large and complex library (or a bunch of them in the case of Prototype + Scriptaculous) across a variety of browsers it is often difficult to tell whether code execution errors are the result of a browser''s ECMAScript non-conformance or some quirk of the library. Most browsers are very compliant, but there is the occasional gotcha. -- Rob --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---