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

Commit

Permalink
refactor(): rename local variables to improve code clarity
Browse files Browse the repository at this point in the history
Closes #12524
  • Loading branch information
IgorMinar authored and petebacondarwin committed Sep 18, 2015
1 parent 2c22c57 commit a654bdf
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/ngSanitize/sanitize.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ var svgElements = toMap("circle,defs,desc,ellipse,font-face,font-face-name,font-
"hkern,image,linearGradient,line,marker,metadata,missing-glyph,mpath,path,polygon,polyline," +
"radialGradient,rect,stop,svg,switch,text,title,tspan,use");

// Special Elements (can contain anything)
var specialElements = toMap("script,style");
// Blocked Elements (will be stripped)
var blockedElements = toMap("script,style");

var validElements = angular.extend({},
voidElements,
Expand Down Expand Up @@ -430,15 +430,15 @@ function encodeEntities(value) {
* }
*/
function htmlSanitizeWriter(buf, uriValidator) {
var ignore = false;
var ignoreCurrentElement = false;
var out = angular.bind(buf, buf.push);
return {
start: function(tag, attrs) {
tag = angular.lowercase(tag);
if (!ignore && specialElements[tag]) {
ignore = tag;
if (!ignoreCurrentElement && blockedElements[tag]) {
ignoreCurrentElement = tag;
}
if (!ignore && validElements[tag] === true) {
if (!ignoreCurrentElement && validElements[tag] === true) {
out('<');
out(tag);
angular.forEach(attrs, function(value, key) {
Expand All @@ -458,17 +458,17 @@ function htmlSanitizeWriter(buf, uriValidator) {
},
end: function(tag) {
tag = angular.lowercase(tag);
if (!ignore && validElements[tag] === true && voidElements[tag] !== true) {
if (!ignoreCurrentElement && validElements[tag] === true && voidElements[tag] !== true) {
out('</');
out(tag);
out('>');
}
if (tag == ignore) {
ignore = false;
if (tag == ignoreCurrentElement) {
ignoreCurrentElement = false;
}
},
chars: function(chars) {
if (!ignore) {
if (!ignoreCurrentElement) {
out(encodeEntities(chars));
}
}
Expand Down

0 comments on commit a654bdf

Please sign in to comment.