Permalink
Browse files

Modified feed parser and html5lib to allow data- HTML5 attributes thr…

…ough because they have no meaning to a browser or SGML parser and may contain meta-data or other attributes that scripts added to the planet page may require.
  • Loading branch information...
1 parent 9de2109 commit cf07846a488fe1c5808ff2ecfdb228126821b2ea @nathan-osman committed May 25, 2012
Showing with 3 additions and 1 deletion.
  1. +2 −0 planet/vendor/feedparser.py
  2. +1 −1 planet/vendor/html5lib/sanitizer.py
View
2 planet/vendor/feedparser.py
@@ -2518,6 +2518,8 @@ def unknown_starttag(self, tag, attrs):
elif key=='style':
clean_value = self.sanitize_style(value)
if clean_value: clean_attrs.append((key,clean_value))
+ elif key.startswith('data-'):
+ clean_attrs.append((key, value))
_BaseHTMLProcessor.unknown_starttag(self, tag, clean_attrs)
def unknown_endtag(self, tag):
View
2 planet/vendor/html5lib/sanitizer.py
@@ -169,7 +169,7 @@ def sanitize_token(self, token):
if token.has_key("data"):
attrs = dict([(name,val) for name,val in
token["data"][::-1]
- if name in self.allowed_attributes])
+ if name in self.allowed_attributes or name.startswith('data-')])
for attr in self.attr_val_is_uri:
if not attrs.has_key(attr):
continue

0 comments on commit cf07846

Please sign in to comment.