Yeah, but couldn't it just go in jQuery main?  It's fundamental enough
that it'd be nice just to have it there.

Best regards,
Jeremy Morton (Jez)

On Dec 12, 5:06 pm, "Kelvin Luck" <[email protected]> wrote:
> Hi,
>
> You could write a _very_ simple plugin to do this if you wanted:
>
> $.fn.delCss = function(p)
> {
>         $(this).css(p, '');
>
> }
>
> Hope that helps,
>
> Kelvin :)
>
> On Fri, 12 Dec 2008 08:42:40 -0800, jez9999 <[email protected]> wrote:
>
> > Hello,
>
> > I'd like to see the following in the next version of jQuery: a
> > function named something like .delCss(name), which would actually
> > delete/unset the style property of the given name on all matched
> > elements.
>
> > See, you can already do this by setting the desired style properties/
> > values in a particular class and then using .removeClass(classname),
> > so it seems to me to be logical that you should be able to do it with
> > CSS style properties too.
>
> > I know common things to do are to set properties to the empty string,
> > or 'default', or something instead, but logically to me it feels nicer
> > to be able to 'unset' the property, even if what jQuery is doing
> > behind the scenes is just setting the property to the empty string.
> > Perhaps in future browsers will offer a genuine way to unset
> > properties in Javascript using an actual Javascrupt 'unset' function,
> > which could then be implemented in jQuery's .delCss() function.
>
> > An example of how this would work would be, say, I set a particular
> > background-color on an element (either using style="" in the markup or
> > via Javascript, which I understand is identical in terms of
> > specificity).  I could then later call $('#myElem').delCss('background-
> > color') on it, which in this property's case would cause the browser
> > to revert it to the default when the property is unspecified -
> > 'transparent' 
> > (seehttp://www.eskimo.com/~bloo/indexdot/css/properties/colorbg/bgcolor.htm).
> > This feels nicer to me than $('#myElem').css('background-color', '').
> > Could we see this in future?  :-)
>
> > Best regards,
> > Jeremy Morton (Jez)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" 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/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to