I don't belive NodeList has splice().

On Sat, Jan 3, 2009 at 5:57 PM, Adam Peller <[email protected]> wrote:

>
> It may have been deliberate to 'duck type' or allow Array-like
> objects.  An instanceof test would be the only accurate test, but it
> may (or may not) be helpful to handle user-created objects as Arrays,
> or other things like NodeList, which seems to have its own special
> handling.
>
> -Adam
>
> On Sat, Jan 3, 2009 at 12:52 PM, Brian Di Palma <[email protected]> wrote:
> > Which explains why the Object is not being taken as an Array.
> >
> > typeof obj.splice === 'function'
> >
> > that condition is failing. Correctly too an object is not an Array.
> >
> > On Sat, Jan 3, 2009 at 4:54 PM, John J Barton <
> [email protected]>
> > wrote:
> >>
> >> Sorry, I was just trying to summarize. The actual test is:
> >> if (isFinite(obj.length) && typeof obj.splice === 'function')
> >>
> >> jjb
> >>
> >> On Jan 3, 8:22 am, "Brian Di Palma" <[email protected]> wrote:
> >> > That's not an Array it's an object. For a native Array length is
> >> > controlled
> >> > for you and splice() is provided to you.
> >> >
> >> > [] === Array
> >> >
> >> > {} === Object
> >> >
> >> > On Sat, Jan 3, 2009 at 7:03 AM, Garrett Smith
> >> > <[email protected]>wrote:
> >> >
> >> >
> >> >
> >> > > On Fri, Jan 2, 2009 at 9:28 PM, John J Barton
> >> > > <[email protected]> wrote:
> >> >
> >> > > > Any Javascript object with 'length' and 'splice' should format as
> an
> >> > > > array. If not please report a bug.
> >> >
> >> > > Using Firebug 1.2.1, an object with properties |length| and |splice|
> >> > > is not formatted the same as an Array.
> >> > > Example:
> >> > > >>> ({splice:1, length:2, '0':0, '1':1, '2':2})
> >> > > Object splice=1 length=2
> >> > > >>> [0,1,2]
> >> > > 0,1,2
> >> >
> >> > > Please describe how an array is to be formatted so that a bug can be
> >> > > filed.
> >> >
> >> > > Thanks,
> >> >
> >> > > Garrett
> >> >
> >> > > > jjb
> >> >
> >> > > > On Jan 2, 11:09 am, Danny <[email protected]> wrote:
> >> > > >> Thanks; that makes sense. But Firebug also changed the way it
> >> > > >> displays
> >> > > >> true arrays. Arrays of simple types like [1,2,3] are listed;
> arrays
> >> > > >> that contain objects are displayed as "Object". console.dir()
> >> > > >> helps,
> >> > > >> but it was nice to have it all in one line.
> >> >
> >> > > >> Danny
> >> >
> >> > > >> On Jan 2, 12:46 pm, John J Barton <[email protected]>
> >> > > >> wrote:
> >> >
> >> > > >> > jQuery('div') is not an array. It has length but not splice. So
> >> > > >> > Firebug does not format it as an array.
> >> >
> >> > > >> > In Javascript, the line between what is an array and what is
> not
> >> > > >> > an
> >> > > >> > array is unclear.  After many versions the current test in
> >> > > >> > Firebug
> >> > > >> > requires an array to have 'length' and 'splice'. Earlier
> versions
> >> > > >> > of
> >> > > >> > Firebug only required 'length', but that caused some objects to
> >> > > >> > be
> >> > > >> > formatted as arrays that did not have numerical indexes.
> >> >
> >> > > >> > jjb
> >> >
> >> > > >> > On Jan 1, 10:10 pm, Danny <[email protected]> wrote:
> >> >
> >> > > >> > > Has anyone else using jQuery noticed that Firebug before 1.2
> >> > > >> > > would
> >> > > >> > > treat console.log(jQuery('div')) as an array and list all the
> >> > > matched
> >> > > >> > > elements on the console, so you could mouse over the list and
> >> > > >> > > highlight the elements, or right-click and scroll into view
> >> > > >> > > etc.,
> >> > > but
> >> > > >> > > now it just lists "Object length=13" and you need to click on
> >> > > >> > > that,
> >> > > >> > > then you get a vertical list that you need to scroll through.
> >> > > >> > > The
> >> > > old
> >> > > >> > > way was more helpful, I think.
> >> >
> >> > > >> > > Workaround: console.log.apply(console, jQuery('div').get())
> >> > > >> > > comes
> >> > > >> > > close to reproducing the old behavior.
> >> >
> >> > > >> > > I'll crosspost this on the jQuery list.
> >>
> >
> >
> > >
> >
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Firebug" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/firebug?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to