From 515ceadddde727b2339c59123f4682a0f05917b2 Mon Sep 17 00:00:00 2001 From: Frederic Massart Date: Tue, 2 Aug 2016 10:56:20 +0800 Subject: [PATCH] MDL-55381 php-css-parser: Patch for Sabberworm/PHP-CSS-Parser#115 REMOVE ME ONCE Sabberworm/PHP-CSS-Parser#115 is merged Part of MDL-55071 --- lib/php-css-parser/CSSList/CSSList.php | 14 ++++++++++++++ lib/php-css-parser/moodle_readme.txt | 2 ++ 2 files changed, 16 insertions(+) diff --git a/lib/php-css-parser/CSSList/CSSList.php b/lib/php-css-parser/CSSList/CSSList.php index bc90460b925..f9986eb3854 100644 --- a/lib/php-css-parser/CSSList/CSSList.php +++ b/lib/php-css-parser/CSSList/CSSList.php @@ -35,6 +35,20 @@ abstract class CSSList implements Renderable, Commentable { $this->aContents[] = $oItem; } + /** + * Insert an item before its sibling. + * + * @param mixed $oItem The item. + * @param mixed $oSibling The sibling. + */ + public function insert($oItem, $oSibling) { + $iIndex = array_search($oSibling, $this->aContents); + if ($iIndex === false) { + return $this->append($oItem); + } + array_splice($this->aContents, $iIndex, 0, array($oItem)); + } + /** * Removes an item from the CSS list. * @param RuleSet|Import|Charset|CSSList $oItemToRemove May be a RuleSet (most likely a DeclarationBlock), a Import, a Charset or another CSSList (most likely a MediaQuery) diff --git a/lib/php-css-parser/moodle_readme.txt b/lib/php-css-parser/moodle_readme.txt index 52e303ee5fb..16b02e2f144 100644 --- a/lib/php-css-parser/moodle_readme.txt +++ b/lib/php-css-parser/moodle_readme.txt @@ -9,3 +9,5 @@ Downloaded from: https://github.com/sabberworm/PHP-CSS-Parser Import procedure: - Copy all the files from the folder 'lib/Sabberworm/CSS/' in this directory. + +- Apply the patch in Sabberworm/PHP-CSS-Parser#115