开发者

Why is my code hanging indefinitely?

I am trying to run the following code that uses Nokogiri, but it is getting stuck when it hits the 161th iteration. List is a set of nodes that were created after parsing a file.

I am left wondering why that is happening, could it be that it is running out of memory? What else could I check if it is hanging indefinitely.

for i in 0...list.length
  puts i
  # puts list[i].inner_html
  while isReady(list[i])
    list[i].inner_html = "#{list[i+1].inner_html}"
    list[i+1].remove
  end
en开发者_如何学JAVAd

Issue resolved I just realized that list[i+1].remove was not removing, and that's why it was hanging indefinitely in that while loop. Thank you for your advice.


what happens when i == list.length, and list[i+1].remove() is called? that looks troublesome.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜