> The basic question is how can to generate this string 'body div h1 b'
> when I stays on "This" or basically how can I know the structure of
> nodes that has this node where I stays.

What you are saying here, is given the element "b", how can you derive
a CSS-style selector that shows the path to that element? Or do you
want to just style up elements that match a certain path when a
certain event occurs?

If the latter, you can do something like:

$$( 'div h1 b' ).invoke( 'setStyle', { color: 'red' } ) // set by CSS properties
$$( 'div h1 b' ).invoke( 'addClassName', 'my-class' ) // just add a class

// the above is shorthand for:
$$( 'div h1 b' ).each( function( element ){
  element.setStyle( { color: 'red' } );
  element.addClassName( 'my-class' );
});

If you'd like to derive the selector, given an element somewhere in
the DOM, I'm not sure how to do that, but possibly XPATH can aid in
that task.

-justin

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" 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/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to