Skip to content

CSS Minification Removes Space in :nth-child(of <selector>), Causing Invalid CSS #441

Open
@Presskopp

Description

@Presskopp

see wp-media/wp-rocket#7363 (reported by @rosamillan)

I think this can be addressed by changing

$content = preg_replace('/:(' . implode('|', $pseudos) . ')\(\s*([+-]?)\s*(.+?)\s*([+-]?)\s*(.*?)\s*\)/', ':$1($2$3$4$5)', $content);

in CSS.php, function stripWhitespace($content) (~ L.758)

to

$content = preg_replace('/:(' . implode('|', $pseudos) . ')\(\s*([+-]?)\s*(.+?)\s*([+-]?)\s*(.*?)\s*(of\s+[^\)]+)?\s*\)/', ':$1($2$3$4$5$6)', $content);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions