~cytrogen/masto-fe

eba3411bfa40cbb36205f58a36e34c446fed0ffa — Plastikmensch 2 years ago 4ddb736
Re-allow title attribute in <abbr> (#2254)

* Re-allow title attribute in <abbr>

This was accidentally removed in 7623e181247b4d2227b7774143514f6e1ca9253b

Signed-off-by: Plastikmensch <plastikmensch@users.noreply.github.com>

* Add test

Add a new test to check that title attribute on <abbr> is kept.

Signed-off-by: Plastikmensch <plastikmensch@users.noreply.github.com>

---------

Signed-off-by: Plastikmensch <plastikmensch@users.noreply.github.com>
2 files changed, 5 insertions(+), 0 deletions(-)

M lib/sanitize_ext/sanitize_config.rb
M spec/lib/sanitize_config_spec.rb
M lib/sanitize_ext/sanitize_config.rb => lib/sanitize_ext/sanitize_config.rb +1 -0
@@ 74,6 74,7 @@ class Sanitize

      attributes: {
        'a' => %w(href rel class title),
        'abbr' => %w(title),
        'span' => %w(class),
        'blockquote' => %w(cite),
        'ol' => %w(start reversed),

M spec/lib/sanitize_config_spec.rb => spec/lib/sanitize_config_spec.rb +4 -0
@@ 43,6 43,10 @@ describe Sanitize::Config do
    it 'keeps a with supported scheme and no host' do
      expect(Sanitize.fragment('<a href="dweb:/a/foo">Test</a>', subject)).to eq '<a href="dweb:/a/foo" rel="nofollow noopener noreferrer" target="_blank">Test</a>'
    end

    it 'keeps title in abbr' do
      expect(Sanitize.fragment('<abbr title="HyperText Markup Language">HTML</abbr>', subject)).to eq '<abbr title="HyperText Markup Language">HTML</abbr>'
    end
  end

  describe '::MASTODON_OUTGOING' do