PseudoNode example

$identifier = $stream->getNextIdentifier();
                if (\in_array(strtolower($identifier)['first-line', 'first-letter', 'before', 'after'])) {
                    // Special case: CSS 2.1 pseudo-elements can have a single ':'.                     // Any new pseudo-element must have two.                     $pseudoElement = $identifier;

                    continue;
                }

                if (!$stream->getPeek()->isDelimiter(['('])) {
                    $result = new Node\PseudoNode($result$identifier);
                    if ('Pseudo[Element[*]:scope]' === $result->__toString()) {
                        $used = \count($stream->getUsed());
                        if (!(2 === $used
                           || 3 === $used && $stream->getUsed()[0]->isWhiteSpace()
                           || $used >= 3 && $stream->getUsed()[$used - 3]->isDelimiter([','])
                           || $used >= 4
                                && $stream->getUsed()[$used - 3]->isWhiteSpace()
                                && $stream->getUsed()[$used - 4]->isDelimiter([','])
                        )) {
                            throw SyntaxErrorException::notAtTheStartOfASelector('scope');
                        }
                    }
namespace Symfony\Component\CssSelector\Tests\Node;

use Symfony\Component\CssSelector\Node\ElementNode;
use Symfony\Component\CssSelector\Node\PseudoNode;

class PseudoNodeTest extends AbstractNodeTestCase
{
    public static function getToStringConversionTestData()
    {
        return [
            [new PseudoNode(new ElementNode(), 'pseudo'), 'Pseudo[Element[*]:pseudo]'],
        ];
    }

    public static function getSpecificityValueTestData()
    {
        return [
            [new PseudoNode(new ElementNode(), 'pseudo'), 10],
        ];
    }
}
Home | Imprint | This part of the site doesn't use cookies.