That's even better.  Sorry I hadn't read closely enough.

That would satisfy all the requirements, and various expectations for
it to act like an object/array/string.  It would fail in an
"instanceof Array" test but that is a small price to pay.

On May 7, 10:15 am, Daniel Friesen <nadir.seen.f...@gmail.com> wrote:
> The problem there is I don't think it's a good idea to throw out output
> which makes this kind of thing illegal:
> e.style.margin = $(node).css('margin');
>
> Which is why I made note of a technique like so:
>
> var top = ..., right = ..., ...;
> return {
>     top: top, right: right, bottom: bottom, left: left,
>     0: top, 1: right, 2: bottom, 3: left,
>     toString: function() { return [top, right, bottom, left].join(' '); }
>
> };
>
> ~Daniel Friesen (Dantman, Nadir-Seen-Fire)
>
> Stephen McKamey wrote:
> > In thinking more about the deeper problem, it seems to me an array of
> > the values is the right answer.  Each value in the array would
> > correspond to the value returned if querying the simple property.  I
> > am unable to think of a CSS compound property that doesn't denote its
> > parts delimited by whitespace.  This means that it would be possible
> > to return meaningful data.
>
> > So if the browser returns "5px 5px 5px 5px" then jQuery returns an
> > array of values simply in the order the browser gives it, but if it
> > returns "5px" then it acts as it currently does.  Then the user of
> > this method can determine if it is compound or not based upon if it is
> > handed a collection or scalar value.  Then the method using the value
> > can grab the appropriate piece of information and not need to re-
> > implement the parsing/retrieval logic.
>
> > On May 7, 9:51 am, Stephen McKamey <step...@jsonfx.net> wrote:
>
> >> Yes, I agree that the use-case is in question.  We ran into this when
> >> a using the autogrow plugin:
>
> >>    http://plugins.jquery.com/project/autogrow
>
> >> This plugin should be modified to check the appropriate sides and
> >> handle correctly.
>
> >> On the other hand, I don't think that crashing is an appropriate
> >> response from jQuery.  I would be happy if it simply returned the
> >> string value as this is at least recoverable and makes more sense than
> >> "Error: invalid argument".
>
> >> On May 6, 8:08 pm, Brandon Aaron <brandon.aa...@gmail.com> wrote:
>
> >>> I believe that is exactly what we are trying to do. There is an ongoing
> >>> discussion about how to handle retrieval of CSS shorthand properties in 
> >>> the
> >>> ticket 4295 (http://dev.jquery.com/ticket/4295). I think most of the
> >>> confusion, at least for me, has been around the use-case for getting the
> >>> short-hand. The reason for my first question... trying to understand the
> >>> actual need. From this thread (and the ticket) it sounds like maybe the
> >>> developer just needs to copy the padding from one element to another.
> >>> Reasonable use-case but what about when the developer wants to copy the
> >>> "background" property. Isn't it more confusing to support just a subset
> >>> versus all the shorthands? Maybe a better solution is to find a better way
> >>> to copy CSS from one element to another... if that really is the primary
> >>> use-case for supporting CSS shorthand properties.
>
> >>> --
> >>> Brandon Aaron
>
> >>> On Wed, May 6, 2009 at 9:36 PM, Matt Kruse <m...@thekrusefamily.com> 
> >>> wrote:
>
> >>>> On May 6, 8:28 pm, Brandon Aaron <brandon.aa...@gmail.com> wrote:
>
> >>>>> Out of curiosity... what are you expecting back from the call to padding
> >>>>> when it is different for top/bottom vs left/right?
>
> >>>> I think an equally valid question is... what does jQuery intend to do
> >>>> in such situations? Clearly, crashing is not the best option.
>
> >>>> Anything that causes the code to completely crash should be avoided by
> >>>> either checking for valid input (if some inputs are considered
> >>>> invalid) or by deciding how to handle cases that don't have obvious
> >>>> answers (like this case). It's not enough, IMO, to ignore the tough
> >>>> questions of how jQuery should behave and point to an alternative. :)
>
> >>>> In the example case:
>
> >>>> #foo { padding: 5px 10px; }
>
> >>>> you may want to consider returning [5,10,5,10] for example.
>
> >>>> Matt Kruse
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to