class Loofah::Scrubbers::NoReferrer
scrub!(:noreferrer)¶ ↑
:noreferrer
adds a rel=“noreferrer” attribute to all links
link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>" Loofah.html5_fragment(link_farmers_markup).scrub!(:noreferrer) => "ohai! <a href='http://www.myswarmysite.com/' rel="noreferrer">I like your blog post</a>"
Public Class Methods
Source
# File lib/loofah/scrubbers.rb, line 292 def initialize # rubocop:disable Lint/MissingSuper @direction = :top_down end
Public Instance Methods
Source
# File lib/loofah/scrubbers.rb, line 296 def scrub(node) return CONTINUE unless (node.type == Nokogiri::XML::Node::ELEMENT_NODE) && (node.name == "a") append_attribute(node, "rel", "noreferrer") STOP end