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
This commit is contained in:
Frederic Massart 2016-08-02 10:56:20 +08:00 committed by Dan Poltawski
parent 66bb9eadfe
commit 515ceadddd
2 changed files with 16 additions and 0 deletions

View File

@ -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)

View File

@ -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