I've seen this come up a few times now on SO and watir-general

The issue is that basically a DL typically displays looking a lot like
a table, with name/value pairs.  And people need to know the value for
a given name, but the structure (where everything in the DL is a
sibling) makes this pretty difficult.

What's needed is some easy way to get the DD element affiliated with a
given DT element.

I'm open to good methods to handle this

One thing that occurs to me would be if  a DL element could be treated
a bit like a hash, so you could feed it the text from a DT and get the
associated DD back as an object (or maybe just the contents of the
DD?)

Something perhaps like

  browser.dl(:how => 'what')['text from a dt element']  #> returns
'text from associated dd'


Alternatively, another idea would be a 'to_hash' method for a DL that
would make a hash using the DT's as keys and the DD's as values.
However I'm not sure that would always work out given how potentially
abusable um I mean versitile, DL's are given that the relationsip
appears kinda potentially many-many and each tag can contain a large
number of things ('flow content') can be found inside either a DT or a
DD

Just looking at it now, and yeah right..  the spec is pretty open
ended and makes me wish for something akin to a cucumber or set of
rspec specs with definitive examples that would tell me how the hell
this stuff is supposed to render..  it makes it sound like the DT-DD
relationship is not 1:1 but potentially one-or-more to one-or-more

  "The dl element represents a description list, which consists of
zero or more term-description (name-value) groupings; each grouping
associates one or more terms/names (the contents of dt elements) with
one or more descriptions/values (the contents of dd elements)."
_______________________________________________
Wtr-development mailing list
Wtr-development@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-development

Reply via email to