Skip to content

Commit

Permalink
Add test + fix for properly handling empty style elements.
Browse files Browse the repository at this point in the history
  • Loading branch information
strarsis committed Sep 6, 2016
1 parent bf29ceb commit fe759cb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions plugins/inlineStyles.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ exports.fn = function(data, svgoOptions) {
// as last step, remove classes when they are used only by one element in document:
var $styles = $('style');
$styles.each(function(si, $style) {
if($style.children.length == 0) {
return;
}

var css = $style.children[0].data;
var cssAst = cssParser.parse(css);

Expand Down
13 changes: 13 additions & 0 deletions test/plugins/inlineStyles.01.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fe759cb

Please sign in to comment.