Skip to content

Commit

Permalink
Merge pull request #964 from rdkleine/master
Browse files Browse the repository at this point in the history
Support for font-style = italic and font-size = [size em/px/%] in sanitize function validStyles
  • Loading branch information
JoelParke committed Aug 3, 2016
2 parents 526f7a3 + 8b7f6f8 commit dde3d7f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
25 changes: 17 additions & 8 deletions src/textAngular-sanitize.js
Original file line number Diff line number Diff line change
Expand Up @@ -535,19 +535,28 @@ function validStyles(styleAttr){
|| value === 'justify'
)
||
key === 'text-decoration' && (
value === 'underline'
|| value === 'line-through'
)
|| key === 'font-weight' && (
value === 'bold'
)
||
key === 'text-decoration' && (
value === 'underline'
|| value === 'line-through'
)
||
key === 'font-weight' && (
value === 'bold'
)
||
key === 'font-style' && (
value === 'italic'
)
||
key === 'float' && (
value === 'left'
|| value === 'right'
|| value === 'none'
)
||
key === 'font-size' && (
value.match(/[0-9\.]*(px|em|rem|%)/)
)
||
(key === 'width' || key === 'height') && (
value.match(/[0-9\.]*(px|em|rem|%)/)
Expand Down
8 changes: 7 additions & 1 deletion test/textAngularSanitize/sanitize.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@ describe('HTML', function() {
htmlParser('<!--FOOBAR-->', handler);
expect(comment).toEqual('FOOBAR');
});


it('should parse font-style italic', function(){
var html = '<span style="font-type:italic">';
htmlParser(html, handler);
expect(comment).toEqual(html);
});

it('should throw an exception for invalid comments', function() {
var caught=false;
try {
Expand Down

0 comments on commit dde3d7f

Please sign in to comment.