because some people hate top posting see the bottom for my reply...
On Nov 1, 2007 12:23 AM, paraih <peter-IU8KpGjBlL0@public.gmane.org>
wrote:>
> I''m comfortable with js, but always had trouble with js &
doms... not
> to mention writing it for cross-browsers compat.
>
> I have some xml (below) that is coming from an automated process that
> has no IDs or classes in it. I would like to be able to use prototype
> to apply styles to it.
>
> I''d rather not have to pre-process it with perl, java or something
> else, adding the IDs or classes.
>
> I can use the $() utility fine with nodes that have ids, but when I
> try to loop over the nodes using $$() I''m just stuck.
>
> Effectively I want to hide a bunch of the nodes and apply styles to a
> few of the remaining ones... or just rebuild it as a more usable/
> displayable piece of XHTML.
>
> I want to do something like:
> $$("artist").each(function(item, index) {
> item.setStyle({ backgroundColor:
''#900'', fontSize: ''12px'' });
> // or even just add a class or id to the item...
> });
>
> This seems like it should be feasible - any help woudl be greatly
> appreciated it.
>
> Thanks - Peter
>
>
> ---------- sample of xml (From the Now Playing plug-in for itunes)
> -----------
>
> <now_playing playing="1"
timestamp="2007-10-31T14:39:19-05:00">
> <song timestamp="2007-10-31T14:39:18-05:00">
> <title>"Highway Blues"</title>
> <artist>asdf Marc Seales, composer. New Stories.
Ernie Watts,
> saxophone.</artist>
> <album>Speakin'' Out</album>
> <genre>Jazz</genre>
> <kind>AAC audio file</kind>
> <track>1</track>
> <numTracks/>
> <year>1999</year>
> <comments/>
> <time>93</time>
> <bitrate>128</bitrate>
> <rating/>
> <disc/>
> <numDiscs/>
> <playCount>1</playCount>
> <compilation>No</compilation>
> <urlAmazon/>
> <urlApple/>
> <imageSmall/>
> <image/>
> <imageLarge/>
> <composer/>
> <grouping/>
> <urlSource/>
> <file>01 _Highway Blues_ 1.m4a</file>
> <artworkID/>
> </song>
> </now_playing>
>
>
http://prototypejs.org/api/utility/dollar-dollar
"Takes an arbitrary number of CSS selectors (strings) and returns a
document-order array of extended DOM elements that match any of them."
$$ searches the existing DOM for any element that has the css selector
already assigned to it.
it''s almost as if you are trying to use it in reverse...
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---