Skip to content

Commit

Permalink
fix(taSanitize): merge taPreSatitize to taSanitize (#424)
Browse files Browse the repository at this point in the history
  • Loading branch information
marbug committed Dec 12, 2014
1 parent 91b16c8 commit e3c9cf6
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions src/textAngular.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ angular.module('textAngular.factories', [])
return $html[0].innerHTML;
};
return taFixChrome;
}).factory('taPreSanitize', function() {
}).factory('taSanitize', ['$sanitize', function taSanitizeFactory($sanitize){

var convert_info = {
'font-weight': {
Expand Down Expand Up @@ -276,22 +276,15 @@ angular.module('textAngular.factories', [])
});
}

return function(unsafe){

try {
var jq_container = angular.element('<div>' + unsafe + '</div>');
fixChildren( jq_container );
unsafe = jq_container.html();
} catch (e) {
}

return unsafe;
};
}).factory('taSanitize', ['$sanitize', 'taPreSanitize', function taSanitizeFactory($sanitize, taPreSanitize){
return function taSanitize(unsafe, oldsafe, ignore){

if ( !ignore ) {
unsafe = taPreSanitize(unsafe);
try {
var jq_container = angular.element('<div>' + unsafe + '</div>');
fixChildren( jq_container );
unsafe = jq_container.html();
} catch (e) {
}
}

// unsafe and oldsafe should be valid HTML strings
Expand Down

0 comments on commit e3c9cf6

Please sign in to comment.