Ruby on Rails Tuesday, May 31, 2011

On May 31, 2011, at 6:58 PM, Jedrin wrote:

> I tried this which doesn't seem to do anything either:
> page[k].set_style :z_index => 20
>
>
> I believe that the following syntax is valid:
> page[k].set_style :'z-index' => 20
>
> I tried this:
>
> C:\Users\Laurence>irb
> irb(main):001:0>
> irb(main):002:0*
> irb(main):003:0* x = :'z-index'
> => :"z-index"
> irb(main):004:0> x.class
> => Symbol
> irb(main):005:0>
> irb(main):009:0> x
> => :"z-index"
> irb(main):010:0>
>
>

I agree, that does seem to work as expected. I'm not an expert on the
RJS side of things, but I have used Prototype for many years, and $
('foo').setStyle('z-index: 20') certainly works there. Maybe there's
an alternative syntax you could use, where instead of pecking away
with multiple calls to set_style, you could concatenate a hash and
send the whole thing at once, maybe something like foo.set_style {:'z-
index' => 20, :font_size => font_sz, ... }

Walter

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

1 comment:

meav said...

Good article.I really think what you said is right,in modern society,we have so many troubles,if you feel nothing to relax yourself,I suggest you to play the wow and some other games,and you can come to my page to find more information about http//www.mmolive.com/ and http://www.mmohome.com/gold/Maple-Story-US.html

Post a Comment