Hello again. I noticed at one point that Watir::Table#to_a does return empty String for TH tags so i digged into it and saw right away from the code why it does that.
I fixed it and saw that there was a comment before the method: # This method returns the table as a 2 dimensional array. # Don't expect too much if there are nested tables, colspan etc. So i got an idea and made it also work with nested tables by returning multi-dimensional array and not just a 2 dimensional one if nested tables are in use. Also, i added max_depth parameter which by default will be 1, so it would work exactly the same as it was before, except also returning data for TH tags, which was definitely a bug. My solution introduces also #to_a(max_depth=1) to Watir::TableRow, which means that it is possible now to use: row(:something => "something").to_a This also works with nested tables. Actually only this works with nested tables and Watir::Table#to_a just calls #to_a on every row and then just adds all these arrays together into one big array. In short, my fixes/changes will do: 1) fix a bug for Watir::Table#to_a, which also breaks backwards compatibility because TH contents will be returned now 2) add #to_a to Watir::TableRow 3) Support nested tables with max_depth parameter I wanted to know before forking Watir, applying the patch+changes and trying to create tests within Watir repo, if anyone is even interested in these changes. Also, as a sidenote, there has to be something changed with tables API, because other methods won't work with nested tables correctly and the question is of course, how would be the correct behaviour :) Jarmo _______________________________________________ Wtr-development mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-development
