Re-allow title attribute in <abbr> (#2254)

* Re-allow title attribute in <abbr>

This was accidentally removed in 7623e18124

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>
pull/62/head
Plastikmensch 2023-06-19 18:01:35 +02:00 committed by GitHub
parent 4ddb736d95
commit eba3411bfa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View File

@ -74,6 +74,7 @@ class Sanitize
attributes: { attributes: {
'a' => %w(href rel class title), 'a' => %w(href rel class title),
'abbr' => %w(title),
'span' => %w(class), 'span' => %w(class),
'blockquote' => %w(cite), 'blockquote' => %w(cite),
'ol' => %w(start reversed), 'ol' => %w(start reversed),

View File

@ -43,6 +43,10 @@ describe Sanitize::Config do
it 'keeps a with supported scheme and no host' 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>' 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 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 end
describe '::MASTODON_OUTGOING' do describe '::MASTODON_OUTGOING' do