Feature Request: css rules

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Feature Request: css rules

Mike-746
I think it would be nice to be able to create permanent rules in CSS,
so that if I were to change the style of any specific type of element,
it could have a permanent effect on all newly created elements as
well.

Something like...

$.cssRule("p",{marginBottom:"3px"});
or
$.cssRule("p","margin-bottom","3px");


This could in effect be much faster than the current method that sets
each of the styles on the type of element and then the developer needs
to catch every case in the future.

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


Reply | Threaded
Open this post in threaded view
|

Re: Feature Request: css rules

Karl Swedberg-2
Ariel Flesler has already written a plugin for that:


--Karl

____________
Karl Swedberg




On Jan 15, 2010, at 4:03 PM, Mike wrote:

I think it would be nice to be able to create permanent rules in CSS,
so that if I were to change the style of any specific type of element,
it could have a permanent effect on all newly created elements as
well.

Something like...

$.cssRule("p",{marginBottom:"3px"});
or
$.cssRule("p","margin-bottom","3px");


This could in effect be much faster than the current method that sets
each of the styles on the type of element and then the developer needs
to catch every case in the future.
--
You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.




--
You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Feature Request: css rules

Andrea Raimondi-2
In reply to this post by Mike-746
On Fri, Jan 15, 2010 at 10:03 PM, Mike <[hidden email]> wrote:
> I think it would be nice to be able to create permanent rules in CSS,
> so that if I were to change the style of any specific type of element,
> it could have a permanent effect on all newly created elements as
> well.

Hi Mike,

Maybe it's just I didn't sleep enough today(happens often....) but I am not sure
what's the usefulness of what you want to do?
CSS rules can be set for tags regardless of the creation moment(iirc at least).

Wait, maybe I am seeing what you mean: you want to be able to change
f.i. the class of a tag in the
whole page, including newly created elements? If so, what's the
usefulness of the thing?
I can't see why you would want to do something like that, at least - I
can't see a reason considering that's not
something(IMVHO) you should do in general :-)

Rgds,

--
Andrea Raimondi
Senior Software Analyst&Developer

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


Reply | Threaded
Open this post in threaded view
|

Re: Feature Request: css rules

Mike-746
Thank you Karl, that seems to be exactly what I was looking for!

@Andrea...
I know it's potentially a bit of a rare case but I've had to make some
changes to an old page where the css was static but the page had rows
(not table rows) that needed to be able to update based on the width
of the page, but because certain other parts needed to be static
widths it became impossible to give them a percent width or anything
else like that. They don't have a special parent element that can be
set where they can be 100% either so the easiest way was to set the
widths to a static number every resize, but I also had to include a
catch every time new rows were added, and this would allow me to get
rid of the extra step.
As a side note it also seemed to be a bit faster (at least in some
browsers) when I was able to set it via class instead of jquery
iterating through the elements and setting each one (though I haven't
tested with 1.4).

Thanks for the replies though!
-Mike

On Jan 16, 9:11 am, Andrea Raimondi <[hidden email]> wrote:

> On Fri, Jan 15, 2010 at 10:03 PM, Mike <[hidden email]> wrote:
> > I think it would be nice to be able to create permanent rules in CSS,
> > so that if I were to change the style of any specific type of element,
> > it could have a permanent effect on all newly created elements as
> > well.
>
> Hi Mike,
>
> Maybe it's just I didn't sleep enough today(happens often....) but I am not sure
> what's the usefulness of what you want to do?
> CSS rules can be set for tags regardless of the creation moment(iirc at least).
>
> Wait, maybe I am seeing what you mean: you want to be able to change
> f.i. the class of a tag in the
> whole page, including newly created elements? If so, what's the
> usefulness of the thing?
> I can't see why you would want to do something like that, at least - I
> can't see a reason considering that's not
> something(IMVHO) you should do in general :-)
>
> Rgds,
>
> --
> Andrea Raimondi
> Senior Software Analyst&Developer

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