From cc110e64782ce6149af6d21099c2eaf5658b2898 Mon Sep 17 00:00:00 2001 From: Drew Hubl Date: Thu, 29 May 2014 09:48:46 -0600 Subject: [PATCH] Use Python sets instead of conditional continues --- html5lib/sanitizer.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/html5lib/sanitizer.py b/html5lib/sanitizer.py index 469d9b40..5ea20e96 100644 --- a/html5lib/sanitizer.py +++ b/html5lib/sanitizer.py @@ -182,9 +182,7 @@ def allowed_token(self, token, token_type): attrs = dict([(name, val) for name, val in token["data"][::-1] if name in self.allowed_attributes]) - for attr in self.attr_val_is_uri: - if attr not in attrs: - continue + for attr in set(attrs.keys()).intersection(set(self.attr_val_is_uri)): val_unescaped = re.sub("[`\000-\040\177-\240\s]+", '', unescape(attrs[attr])).lower() # remove replacement characters from unescaped characters