-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[CssSelector] Add :has()
support
#49388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
franckranaivo
wants to merge
18
commits into
symfony:7.4
Choose a base branch
from
franckranaivo:css-selector-has-support
base: 7.4
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
18ad9bb
[CssSelector] Add has relation support
franckranaivo fcd700f
[CssSelector] Add test and changelog
franckranaivo 9358c39
Add more complex selector inside has node
franckranaivo 16550a4
Fix syntax standards errors
franckranaivo 0d5497c
Replace node parser for a specific parser
franckranaivo 9aa8311
Fix parser issue always returning direct descendant
franckranaivo 06e0d47
Add translator test
franckranaivo a9e89ba
[CssSelector] Remove unused methods
franckranaivo b30ef12
[CssSelector] Remove unused imports
franckranaivo a6cd7da
[CssSelector] Fix python original url
franckranaivo 0b93e0f
[CssSelector] Fix coding standards issue
franckranaivo fbe8e38
[CssSelector] Fix BC break by adding @method instead of directly addi…
franckranaivo d35086b
[CssSelector] Fix coding standard issue
franckranaivo bebe4c3
[CssSelector] Imperative formulation for changelog
franckranaivo c099d95
Fix Direct adjacent Relation
31771f1
Add relevant test: shakespeare and htmlIds
0605aca
Fix coding standard issues
9dc472a
Fix: remove unused method
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
[CssSelector] Add has relation support
- Loading branch information
commit 18ad9bbfca8892a55682ad793a34aaf12b204d4e
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\CssSelector\Node; | ||
|
||
/** | ||
* Represents a "<selector>:has(<identifier>)" node. | ||
* | ||
* This component is a port of the Python cssselect library, | ||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. | ||
* | ||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com> | ||
* | ||
* @internal | ||
*/ | ||
class RelationNode extends AbstractNode | ||
{ | ||
private NodeInterface $selector; | ||
private NodeInterface $subSelector; | ||
|
||
public function __construct(NodeInterface $selector, NodeInterface $subSelector) | ||
{ | ||
$this->selector = $selector; | ||
$this->subSelector = $subSelector; | ||
} | ||
|
||
public function getSelector(): NodeInterface | ||
{ | ||
return $this->selector; | ||
} | ||
|
||
public function getSubSelector(): NodeInterface | ||
{ | ||
return $this->subSelector; | ||
} | ||
|
||
public function getSpecificity(): Specificity | ||
{ | ||
return $this->selector->getSpecificity()->plus($this->subSelector->getSpecificity()); | ||
} | ||
|
||
public function __toString(): string | ||
{ | ||
return sprintf('%s[%s:has(%s)]', $this->getNodeName(), $this->selector, $this->subSelector); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.