Nokogiri shares all attributes
2 answers
require 'nokogiri'
doc = Nokogiri::HTML('<div class="item"><a href="www"></a></div>')
You can remove all attributes with
xpath:doc.xpath('//@*').removeOr, if you ever need to do something more complex, it is sometimes easier to cross all the elements with:
doc.traverse do |node| node.keys.each do |attribute| node.delete attribute end end
+8