Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dom tree leaves end up on the wrong branches #76

Open
patrickhno opened this issue Aug 10, 2011 · 1 comment
Open

dom tree leaves end up on the wrong branches #76

patrickhno opened this issue Aug 10, 2011 · 1 comment

Comments

@patrickhno
Copy link

I had to add this to our massive project to make it work with the Akephalos driver.
I guess this most likely will need to be passed on to some of the gems deeper down.
I would guess htmlunit passes pure html to nokogiri so the htmlunit side of things should be fine I guess.
What really bugs me is that this works fine with the selenium driver.

I think I can provide the raw html for a page that needs this workaround upon request.

This function seem to suffer a lot on pages with massive tables.

# Workaraound for a bug in the Akephalos driver
# Akephalos some times makes:
#   <tr>
#     <td><..><..><..></td>
#   </tr>
# into:
#   <tr>
#     <td><..></td>
#     <..>
#     <..>
#   </tr>
def self.akephalos_bug_workaround row
  ret = row.dup
  if row.name == 'tr'
    if row.children.size > 0 && row.children[0].respond_to?(:name) && row.children[0].name == 'td'
      ret.children = Nokogiri::XML::NodeSet.new(row.document)
      row.children.each do |td|
        if td.name == 'td'
          ret << td.dup
        else
          ret.children.last << td.dup
        end
      end
    end
  end
  ret
end
@Nerian
Copy link
Contributor

Nerian commented Oct 16, 2011

Hi Patrick,

Does this happen in https://github.com/Nerian/akephalos2 ?

File a bug issue there if that is the case. A failing test sample would be extremely nice :)

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants