@@ -244,8 +244,8 @@ var svgElements = toMap("circle,defs,desc,ellipse,font-face,font-face-name,font-
244
244
"hkern,image,linearGradient,line,marker,metadata,missing-glyph,mpath,path,polygon,polyline," +
245
245
"radialGradient,rect,stop,svg,switch,text,title,tspan,use" ) ;
246
246
247
- // Special Elements (can contain anything )
248
- var specialElements = toMap ( "script,style" ) ;
247
+ // Blocked Elements (will be stripped )
248
+ var blockedElements = toMap ( "script,style" ) ;
249
249
250
250
var validElements = angular . extend ( { } ,
251
251
voidElements ,
@@ -430,15 +430,15 @@ function encodeEntities(value) {
430
430
* }
431
431
*/
432
432
function htmlSanitizeWriter ( buf , uriValidator ) {
433
- var ignore = false ;
433
+ var ignoreCurrentElement = false ;
434
434
var out = angular . bind ( buf , buf . push ) ;
435
435
return {
436
436
start : function ( tag , attrs ) {
437
437
tag = angular . lowercase ( tag ) ;
438
- if ( ! ignore && specialElements [ tag ] ) {
439
- ignore = tag ;
438
+ if ( ! ignoreCurrentElement && blockedElements [ tag ] ) {
439
+ ignoreCurrentElement = tag ;
440
440
}
441
- if ( ! ignore && validElements [ tag ] === true ) {
441
+ if ( ! ignoreCurrentElement && validElements [ tag ] === true ) {
442
442
out ( '<' ) ;
443
443
out ( tag ) ;
444
444
angular . forEach ( attrs , function ( value , key ) {
@@ -458,17 +458,17 @@ function htmlSanitizeWriter(buf, uriValidator) {
458
458
} ,
459
459
end : function ( tag ) {
460
460
tag = angular . lowercase ( tag ) ;
461
- if ( ! ignore && validElements [ tag ] === true && voidElements [ tag ] !== true ) {
461
+ if ( ! ignoreCurrentElement && validElements [ tag ] === true && voidElements [ tag ] !== true ) {
462
462
out ( '</' ) ;
463
463
out ( tag ) ;
464
464
out ( '>' ) ;
465
465
}
466
- if ( tag == ignore ) {
467
- ignore = false ;
466
+ if ( tag == ignoreCurrentElement ) {
467
+ ignoreCurrentElement = false ;
468
468
}
469
469
} ,
470
470
chars : function ( chars ) {
471
- if ( ! ignore ) {
471
+ if ( ! ignoreCurrentElement ) {
472
472
out ( encodeEntities ( chars ) ) ;
473
473
}
474
474
}
0 commit comments