Merge pull request #1801 from umap-project/1796-add-purify-attributes
fix: allow `dir` and `title` attributes
This commit is contained in:
commit
dcad0e1bb2
2 changed files with 8 additions and 1 deletions
|
@ -88,7 +88,7 @@ export function escapeHTML(s) {
|
|||
'span',
|
||||
],
|
||||
ADD_ATTR: ['target', 'allow', 'allowfullscreen', 'frameborder', 'scrolling'],
|
||||
ALLOWED_ATTR: ['href', 'src', 'width', 'height', 'style'],
|
||||
ALLOWED_ATTR: ['href', 'src', 'width', 'height', 'style', 'dir', 'title'],
|
||||
// Added: `geo:` URL scheme as defined in RFC5870:
|
||||
// https://www.rfc-editor.org/rfc/rfc5870.html
|
||||
// The base RegExp comes from:
|
||||
|
|
|
@ -185,6 +185,13 @@ describe('Utils', function () {
|
|||
assert.equal(Utils.escapeHTML('<a href="geo:1,2"></a>'), '<a href="geo:1,2"></a>')
|
||||
})
|
||||
|
||||
it('should not escape dir and title attributes', function () {
|
||||
assert.equal(
|
||||
Utils.escapeHTML('<a title="Title" dir="rtl"></a>'),
|
||||
'<a dir="rtl" title="Title"></a>'
|
||||
)
|
||||
})
|
||||
|
||||
it('should not fail with int value', function () {
|
||||
assert.equal(Utils.escapeHTML(25), '25')
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue