parent
8d24cc0ceb
commit
5b9746066c
2 changed files with 8 additions and 1 deletions
|
@ -88,7 +88,7 @@ export function escapeHTML(s) {
|
||||||
'span',
|
'span',
|
||||||
],
|
],
|
||||||
ADD_ATTR: ['target', 'allow', 'allowfullscreen', 'frameborder', 'scrolling'],
|
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:
|
// Added: `geo:` URL scheme as defined in RFC5870:
|
||||||
// https://www.rfc-editor.org/rfc/rfc5870.html
|
// https://www.rfc-editor.org/rfc/rfc5870.html
|
||||||
// The base RegExp comes from:
|
// 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>')
|
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 () {
|
it('should not fail with int value', function () {
|
||||||
assert.equal(Utils.escapeHTML(25), '25')
|
assert.equal(Utils.escapeHTML(25), '25')
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue