mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-25 22:33:44 +00:00
feat($sanitize): support telephone links
Per http://www.ietf.org/rfc/rfc3966.txt support tel: links
This commit is contained in:
parent
8650843603
commit
04450c48df
2 changed files with 4 additions and 3 deletions
|
|
@ -123,7 +123,7 @@ var START_TAG_REGEXP = /^<\s*([\w:-]+)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:
|
||||||
BEGING_END_TAGE_REGEXP = /^<\s*\//,
|
BEGING_END_TAGE_REGEXP = /^<\s*\//,
|
||||||
COMMENT_REGEXP = /<!--(.*?)-->/g,
|
COMMENT_REGEXP = /<!--(.*?)-->/g,
|
||||||
CDATA_REGEXP = /<!\[CDATA\[(.*?)]]>/g,
|
CDATA_REGEXP = /<!\[CDATA\[(.*?)]]>/g,
|
||||||
URI_REGEXP = /^((ftp|https?):\/\/|mailto:|#)/,
|
URI_REGEXP = /^((ftp|https?):\/\/|mailto:|tel:|#)/,
|
||||||
NON_ALPHANUMERIC_REGEXP = /([^\#-~| |!])/g; // Match everything outside of normal chars and " (quote character)
|
NON_ALPHANUMERIC_REGEXP = /([^\#-~| |!])/g; // Match everything outside of normal chars and " (quote character)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -188,7 +188,7 @@ describe('HTML', function() {
|
||||||
expect(html).toEqual('<div>');
|
expect(html).toEqual('<div>');
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('explicitly dissallow', function() {
|
describe('explicitly disallow', function() {
|
||||||
it('should not allow attributes', function() {
|
it('should not allow attributes', function() {
|
||||||
writer.start('div', {id:'a', name:'a', style:'a'});
|
writer.start('div', {id:'a', name:'a', style:'a'});
|
||||||
expect(html).toEqual('<div>');
|
expect(html).toEqual('<div>');
|
||||||
|
|
@ -230,10 +230,11 @@ describe('HTML', function() {
|
||||||
expect(isUri('https://abc')).toBeTruthy();
|
expect(isUri('https://abc')).toBeTruthy();
|
||||||
expect(isUri('ftp://abc')).toBeTruthy();
|
expect(isUri('ftp://abc')).toBeTruthy();
|
||||||
expect(isUri('mailto:me@example.com')).toBeTruthy();
|
expect(isUri('mailto:me@example.com')).toBeTruthy();
|
||||||
|
expect(isUri('tel:123-123-1234')).toBeTruthy();
|
||||||
expect(isUri('#anchor')).toBeTruthy();
|
expect(isUri('#anchor')).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not be UIR', function() {
|
it('should not be URI', function() {
|
||||||
expect(isUri('')).toBeFalsy();
|
expect(isUri('')).toBeFalsy();
|
||||||
expect(isUri('javascript:alert')).toBeFalsy();
|
expect(isUri('javascript:alert')).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue