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

Commit 9d2a6ef

Browse files
committed
fix(*): handle empty srcsets, and jshint prefers === overall
1 parent c71e082 commit 9d2a6ef

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/ng/compile.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,7 +1434,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
14341434
// That works even dynamically, but it's not bypassable through the $sce.
14351435
// Instead, if you want several unsafe URLs as-is, you should probably
14361436
// use trustAsHtml on the whole tag.
1437-
if (nodeName === 'img' && key === 'srcset') {
1437+
if (nodeName === 'img' && key === 'srcset' && value) {
14381438

14391439
// sanitize img[srcset] values
14401440
var result = "";
@@ -2929,11 +2929,11 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
29292929
(tag !== "img" && (attrNormalizedName === "src" ||
29302930
attrNormalizedName === "ngSrc"))) {
29312931
return $sce.RESOURCE_URL;
2932-
} else if (tag == "img" && (attrNormalizedName == "src" ||
2933-
attrNormalizedName == "ngSrc") ||
2934-
tag == "a" && (attrNormalizedName == "href" ||
2935-
attrNormalizedName == "xlinkHref" ||
2936-
attrNormalizedName == "ngHref")) {
2932+
} else if (tag === "img" && (attrNormalizedName === "src" ||
2933+
attrNormalizedName === "ngSrc") ||
2934+
tag === "a" && (attrNormalizedName === "href" ||
2935+
attrNormalizedName === "xlinkHref" ||
2936+
attrNormalizedName === "ngHref")) {
29372937
return $sce.URL;
29382938
}
29392939
}

src/ng/interpolate.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ function $InterpolateProvider() {
138138
}
139139

140140
function isConcatenationAllowed(context) {
141-
return context == $sce.URL;
141+
return context === $sce.URL;
142142
}
143143

144144
/**
@@ -307,7 +307,7 @@ function $InterpolateProvider() {
307307
}
308308
}
309309

310-
if (concat.length == 1 && expressionPositions.length == 1) {
310+
if (concat.length === 1 && expressionPositions.length === 1) {
311311
singleExpression = true;
312312
}
313313

0 commit comments

Comments
 (0)