Open amalhotra opened 9 years ago
Quite possibly. Happy to accept a pull request.
I haven't looked into it as such. What exactly is this code trying to do:
document = HTML::Document.new(raw_html)
document.root.children.each do |child|
if child.tag?
innerHTML = "";
child.children.each { |child_child| innerHTML << child_child.to_s }
tags.push({
:name => child.name,
:attributes => child.attributes,
:innerHTML => innerHTML
});
end
Are you trying to strip_tags? There is a helper for that now. Otherwise using Nokogiri might be the way to go.
I think the original idea was to serialize the html code so that the injected javascript can add it to the host website.
When you say serialize, what exactly are we serializing it to?
Looks like an array of tags. Tags are serialized as associative array with tag name, attributes in innerhtml. We then use JS to deserialize this. I think the reason for that was to not make the host website depend on jQuery (otherwise we could probably have just taken the whole thing as a string and be done with it).
Using Rails 4.2.0.
NameError (uninitialized constant RailsBookmarklet::HTML): app/controllers/bookmarklet_controller.rb:10:in
show'`app/controllers/bookmarklet_controller.rb
app/helpers/bookmarklet_helper.rb
My guess is that
HTML::Document
in render_bookmarklet is not working anymore.