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

Commit a654bdf

Browse files
IgorMinarpetebacondarwin
authored andcommitted
refactor(): rename local variables to improve code clarity
Closes #12524
1 parent 2c22c57 commit a654bdf

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/ngSanitize/sanitize.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,8 @@ var svgElements = toMap("circle,defs,desc,ellipse,font-face,font-face-name,font-
244244
"hkern,image,linearGradient,line,marker,metadata,missing-glyph,mpath,path,polygon,polyline," +
245245
"radialGradient,rect,stop,svg,switch,text,title,tspan,use");
246246

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

250250
var validElements = angular.extend({},
251251
voidElements,
@@ -430,15 +430,15 @@ function encodeEntities(value) {
430430
* }
431431
*/
432432
function htmlSanitizeWriter(buf, uriValidator) {
433-
var ignore = false;
433+
var ignoreCurrentElement = false;
434434
var out = angular.bind(buf, buf.push);
435435
return {
436436
start: function(tag, attrs) {
437437
tag = angular.lowercase(tag);
438-
if (!ignore && specialElements[tag]) {
439-
ignore = tag;
438+
if (!ignoreCurrentElement && blockedElements[tag]) {
439+
ignoreCurrentElement = tag;
440440
}
441-
if (!ignore && validElements[tag] === true) {
441+
if (!ignoreCurrentElement && validElements[tag] === true) {
442442
out('<');
443443
out(tag);
444444
angular.forEach(attrs, function(value, key) {
@@ -458,17 +458,17 @@ function htmlSanitizeWriter(buf, uriValidator) {
458458
},
459459
end: function(tag) {
460460
tag = angular.lowercase(tag);
461-
if (!ignore && validElements[tag] === true && voidElements[tag] !== true) {
461+
if (!ignoreCurrentElement && validElements[tag] === true && voidElements[tag] !== true) {
462462
out('</');
463463
out(tag);
464464
out('>');
465465
}
466-
if (tag == ignore) {
467-
ignore = false;
466+
if (tag == ignoreCurrentElement) {
467+
ignoreCurrentElement = false;
468468
}
469469
},
470470
chars: function(chars) {
471-
if (!ignore) {
471+
if (!ignoreCurrentElement) {
472472
out(encodeEntities(chars));
473473
}
474474
}

0 commit comments

Comments
 (0)