diff --git a/package-lock.json b/package-lock.json
index c2529f0998..57f1d143ef 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -46,7 +46,7 @@
"source-map-support": "^0.5.21",
"sourcemap-codec": "^1.4.8",
"tiny-glob": "^0.2.9",
- "tslib": "^2.4.0",
+ "tslib": "^2.4.1",
"typescript": "^3.7.5",
"util": "^0.12.5"
},
@@ -4840,9 +4840,9 @@
}
},
"node_modules/tslib": {
- "version": "2.4.0",
- "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz",
- "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==",
+ "version": "2.4.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz",
+ "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==",
"dev": true
},
"node_modules/tsutils": {
@@ -8977,9 +8977,9 @@
}
},
"tslib": {
- "version": "2.4.0",
- "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz",
- "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==",
+ "version": "2.4.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz",
+ "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==",
"dev": true
},
"tsutils": {
diff --git a/package.json b/package.json
index 1dc3d95e0b..6499c5baf9 100644
--- a/package.json
+++ b/package.json
@@ -153,7 +153,7 @@
"source-map-support": "^0.5.21",
"sourcemap-codec": "^1.4.8",
"tiny-glob": "^0.2.9",
- "tslib": "^2.4.0",
+ "tslib": "^2.4.1",
"typescript": "^3.7.5"
}
}
diff --git a/src/compiler/compile/nodes/Element.ts b/src/compiler/compile/nodes/Element.ts
index 303b2e9122..ca9bcb8c4e 100644
--- a/src/compiler/compile/nodes/Element.ts
+++ b/src/compiler/compile/nodes/Element.ts
@@ -620,17 +620,18 @@ export default class Element extends Node {
if (href_static_value === null || href_static_value.match(/^(https?:)?\/\//i)) {
const rel = attribute_map.get('rel');
- const rel_values = rel ? rel.get_static_value().split(' ') : [];
- const expected_values = ['noreferrer'];
-
- expected_values.forEach(expected_value => {
- if (!rel || rel && rel_values.indexOf(expected_value) < 0) {
- component.warn(this, {
- code: `security-anchor-rel-${expected_value}`,
- message: `Security: Anchor with "target=_blank" should have rel attribute containing the value "${expected_value}"`
- });
- }
- });
+ if (rel == null || rel.is_static) {
+ const rel_values = rel ? rel.get_static_value().split(' ') : [];
+ const expected_values = ['noreferrer'];
+ expected_values.forEach(expected_value => {
+ if (!rel || rel && rel_values.indexOf(expected_value) < 0) {
+ component.warn(this, {
+ code: `security-anchor-rel-${expected_value}`,
+ message: `Security: Anchor with "target=_blank" should have rel attribute containing the value "${expected_value}"`
+ });
+ }
+ });
+ }
}
}
diff --git a/test/validator/samples/security-anchor-rel-noreferrer/input.svelte b/test/validator/samples/security-anchor-rel-noreferrer/input.svelte
index de52d5a596..f5361e5cfe 100644
--- a/test/validator/samples/security-anchor-rel-noreferrer/input.svelte
+++ b/test/validator/samples/security-anchor-rel-noreferrer/input.svelte
@@ -28,4 +28,6 @@
svelte website (valid)
svelte website (valid)
svelte website (valid)
-svelte website (valid)
\ No newline at end of file
+svelte website (valid)
+
+svelte website (valid)