mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
Merge branch 'MDL-70300' of https://github.com/Chocolate-lightning/moodle
This commit is contained in:
commit
cdcc37ad68
4 changed files with 34 additions and 15 deletions
|
@ -69,9 +69,34 @@ abstract class CSSBlockList extends CSSList {
|
||||||
if ($sSpecificitySearch === null) {
|
if ($sSpecificitySearch === null) {
|
||||||
$aResult[] = $oSelector;
|
$aResult[] = $oSelector;
|
||||||
} else {
|
} else {
|
||||||
$sComparison = "\$bRes = {$oSelector->getSpecificity()} $sSpecificitySearch;";
|
$sComparator = '===';
|
||||||
eval($sComparison);
|
$aSpecificitySearch = explode(' ', $sSpecificitySearch);
|
||||||
if ($bRes) {
|
$iTargetSpecificity = $aSpecificitySearch[0];
|
||||||
|
if(count($aSpecificitySearch) > 1) {
|
||||||
|
$sComparator = $aSpecificitySearch[0];
|
||||||
|
$iTargetSpecificity = $aSpecificitySearch[1];
|
||||||
|
}
|
||||||
|
$iTargetSpecificity = (int)$iTargetSpecificity;
|
||||||
|
$iSelectorSpecificity = $oSelector->getSpecificity();
|
||||||
|
$bMatches = false;
|
||||||
|
switch($sComparator) {
|
||||||
|
case '<=':
|
||||||
|
$bMatches = $iSelectorSpecificity <= $iTargetSpecificity;
|
||||||
|
break;
|
||||||
|
case '<':
|
||||||
|
$bMatches = $iSelectorSpecificity < $iTargetSpecificity;
|
||||||
|
break;
|
||||||
|
case '>=':
|
||||||
|
$bMatches = $iSelectorSpecificity >= $iTargetSpecificity;
|
||||||
|
break;
|
||||||
|
case '>':
|
||||||
|
$bMatches = $iSelectorSpecificity > $iTargetSpecificity;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$bMatches = $iSelectorSpecificity === $iTargetSpecificity;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if ($bMatches) {
|
||||||
$aResult[] = $oSelector;
|
$aResult[] = $oSelector;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,9 +72,6 @@ class Document extends CSSBlockList {
|
||||||
* @example getSelectorsBySpecificity('>= 100')
|
* @example getSelectorsBySpecificity('>= 100')
|
||||||
*/
|
*/
|
||||||
public function getSelectorsBySpecificity($sSpecificitySearch = null) {
|
public function getSelectorsBySpecificity($sSpecificitySearch = null) {
|
||||||
if (is_numeric($sSpecificitySearch) || is_numeric($sSpecificitySearch[0])) {
|
|
||||||
$sSpecificitySearch = "== $sSpecificitySearch";
|
|
||||||
}
|
|
||||||
$aResult = array();
|
$aResult = array();
|
||||||
$this->allSelectors($aResult, $sSpecificitySearch);
|
$this->allSelectors($aResult, $sSpecificitySearch);
|
||||||
return $aResult;
|
return $aResult;
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
PHP CSS Parser
|
PHP CSS Parser
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
Downloaded from: https://github.com/sabberworm/PHP-CSS-Parser/releases/tag/8.3.0
|
|
||||||
|
|
||||||
Import procedure:
|
Import procedure:
|
||||||
|
1. Download the latest release from https://github.com/sabberworm/PHP-CSS-Parser/releases
|
||||||
- Copy all the files from the folder 'lib/Sabberworm/CSS/' in this directory.
|
2. Copy all the files from the folder 'lib/Sabberworm/CSS/' in this directory.
|
||||||
|
3. Apply the following patches from the following pull requests if they have not yet been merged upstream:
|
||||||
- Apply the patch in Sabberworm/PHP-CSS-Parser#115
|
a. https://github.com/sabberworm/PHP-CSS-Parser/pull/115
|
||||||
|
b. https://github.com/sabberworm/PHP-CSS-Parser/pull/173
|
||||||
- Apply the patch in sabberworm/PHP-CSS-Parser/issues/173 (if this has not already been resolved upstream).
|
|
||||||
|
|
|
@ -217,7 +217,7 @@
|
||||||
<location>php-css-parser</location>
|
<location>php-css-parser</location>
|
||||||
<name>PHP-CSS-Parser</name>
|
<name>PHP-CSS-Parser</name>
|
||||||
<license>MIT</license>
|
<license>MIT</license>
|
||||||
<version>8.3.0</version>
|
<version>8.3.1</version>
|
||||||
</library>
|
</library>
|
||||||
<library>
|
<library>
|
||||||
<location>rtlcss</location>
|
<location>rtlcss</location>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue