Commit fc1ea259 authored by neclimdul's avatar neclimdul

Backport #1704894 and #1724332 both by tim.plunkett

Backport bug fixes to property parsing.
parent be78bf72
......@@ -308,8 +308,9 @@ function ctools_css_disassemble($css) {
$disassembled_css = array();
// Remove comments.
$css = preg_replace("/\/\*(.*)?\*\//Usi", "", $css);
// Split out each statement
$statements = preg_split('/[;}]/', $css);
// Split out each statement. Match either a right curly brace or a semi-colon
// that precedes a left curly brace with no right curly brace separating them.
$statements = preg_split('/}|;(?=[^}]*{)/', $css);
// If we have any statements, parse them.
if (!empty($statements)) {
......@@ -331,13 +332,10 @@ function ctools_css_disassemble($css) {
}
// Disassemble the declaration, check it and tuck it into an array.
$declarations = _ctools_css_disassemble_declaration($declaration);
if (!isset($disassembled_css[$selector_str])) {
$disassembled_css[$selector_str] = $declarations;
}
else {
$disassembled_css[$selector_str] += $declarations;
$disassembled_css[$selector_str] = array();
}
$disassembled_css[$selector_str] += _ctools_css_disassemble_declaration($declaration);
}
}
return $disassembled_css;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment