Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#4822 closed defect (fixed)

NodeList.style is a real odd ball

Reported by: ptwobrussell Owned by: alex
Priority: high Milestone: 1.0
Component: Core Version: 1.0
Keywords: Cc: ptwobrussell@…
Blocked By: Blocking:

Description

So....NodeList?.style only operates on the first element of a NodeList?, which makes it an oddball since in general, the NodeList? ops operate on the entire list, not just the first element. NodeList?.styles, for example, operates on each element of a NodeList?, so does NodeList?.map, so does NodeList?.filter, etc.

A conversation transpired in IRC that didn't really determine anything concrete, but some of the thoughts were that:

  • NodeList?.style is an oddball and doesn't fit in real well. We're not sure if it's even being used anywhere useful. Plus, it's taking up space in Base...
  • NodeList?.styles makes perfect sense, although "styles" sounds oddly plural...so if NodeList?.style were deemed unnecessary and eliminated, perhaps NodeList?.styles would then be renamed to be NodeList?.style
  • If it's absolutely deemed necessary to keep an operation that operates on only the first element of a NodeList?, then perhaps there should be a better abstraction: car and cdr operators. a "car" operator would take NodeList? and only return the first element, which could then be operated on, and a "cdr" operator would return everything except the first element. "car" and "cdr" references for those who haven't dabbled with lisp: http://en.wikipedia.org/wiki/CAR_and_CDR

It seems to me that the car/cdr approach seems like a good one. The size incurred by including these ops would be minimal...probably even less than the space that NodeList?.style currently takes up right now. If I were voting, I think I'd either go the car/cdr route or just kill off NodeList?.style all together.

Change History (2)

comment:1 Changed 12 years ago by alex

Resolution: fixed
Status: newclosed

(In [11146]) making the constructor smaller ('cause we can), adding slice/splice, and moving animations out to dojo.NodeList?-ext. Refs #4480. Refs #4205. Fixes #4822

comment:2 Changed 12 years ago by alex

(In [11147]) tests for slice/splice. Splice isn't working correctly on IE 6 yet (still digging). Refs #4822. Refs #4205

Note: See TracTickets for help on using tickets.