Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 04450c4

Browse files
annavesterIgorMinar
authored andcommitted
feat($sanitize): support telephone links
Per http://www.ietf.org/rfc/rfc3966.txt support tel: links
1 parent 8650843 commit 04450c4

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/ngSanitize/sanitize.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ var START_TAG_REGEXP = /^<\s*([\w:-]+)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:
123123
BEGING_END_TAGE_REGEXP = /^<\s*\//,
124124
COMMENT_REGEXP = /<!--(.*?)-->/g,
125125
CDATA_REGEXP = /<!\[CDATA\[(.*?)]]>/g,
126-
URI_REGEXP = /^((ftp|https?):\/\/|mailto:|#)/,
126+
URI_REGEXP = /^((ftp|https?):\/\/|mailto:|tel:|#)/,
127127
NON_ALPHANUMERIC_REGEXP = /([^\#-~| |!])/g; // Match everything outside of normal chars and " (quote character)
128128

129129

test/ngSanitize/sanitizeSpec.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ describe('HTML', function() {
188188
expect(html).toEqual('<div>');
189189
});
190190

191-
describe('explicitly dissallow', function() {
191+
describe('explicitly disallow', function() {
192192
it('should not allow attributes', function() {
193193
writer.start('div', {id:'a', name:'a', style:'a'});
194194
expect(html).toEqual('<div>');
@@ -230,10 +230,11 @@ describe('HTML', function() {
230230
expect(isUri('https://abc')).toBeTruthy();
231231
expect(isUri('ftp://abc')).toBeTruthy();
232232
expect(isUri('mailto:[email protected]')).toBeTruthy();
233+
expect(isUri('tel:123-123-1234')).toBeTruthy();
233234
expect(isUri('#anchor')).toBeTruthy();
234235
});
235236

236-
it('should not be UIR', function() {
237+
it('should not be URI', function() {
237238
expect(isUri('')).toBeFalsy();
238239
expect(isUri('javascript:alert')).toBeFalsy();
239240
});

0 commit comments

Comments
 (0)