diff --git a/mincss/processor.py b/mincss/processor.py index e2c3c73..3026262 100644 --- a/mincss/processor.py +++ b/mincss/processor.py @@ -190,7 +190,11 @@ def process_html(self, html, url): self._all_classes.add(class_) for style in CSSSelector('style')(page): - first_line = style.text.strip().splitlines()[0] + try: + first_line = style.text.strip().splitlines()[0] + except IndexError: + # meaning the inline style tag was just whitespace + continue for i, line in enumerate(lines): if line.count(first_line): key = (i + 1, url) diff --git a/tests/one-2.html b/tests/one-2.html new file mode 100644 index 0000000..d46b244 --- /dev/null +++ b/tests/one-2.html @@ -0,0 +1,16 @@ + + +
+ +