Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix now walking full DOM in change_hrefs.

  • Loading branch information...
commit 5f3567eac26b516982261e38856fd026b68e87bd 1 parent c301a88
@orangemug orangemug authored
Showing with 3 additions and 2 deletions.
  1. +2 −1  lib/epub/dom.rb
  2. +1 −1  lib/epub/item/html.rb
View
3  lib/epub/dom.rb
@@ -14,7 +14,8 @@ module DOM
NOTATION_NODE = 12
def self.walk(dom, &block)
- yield(dom)
+ yield(dom) if dom.is_a?(Nokogiri::XML::Element)
+
for node in dom.children
walk(node, &block) if node.type == ELEMENT_NODE
end
View
2  lib/epub/item/html.rb
@@ -85,7 +85,7 @@ def remove_scripts(html)
#
# @param [Nokogiri::XML] html document DOM
def change_hrefs(html)
- DOM.walk(html.children.first) do |node|
+ DOM.walk(html) do |node|
for attr_name in %w{href src}
attr_obj = node.attributes[attr_name]
Please sign in to comment.
Something went wrong with that request. Please try again.