Skip to content

magento-obsessive-owls/CssXPath

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Translate CSS selectors to XPath queries.

A lightweight and dependency free CSS to XPath translator. This repository is used to bring modern DOM functionality like querySelectorAll() to PHP in the PHP.Gt/Dom project.


Build status Code quality Code coverage Current version PHP.Gt/CssXPath documentation

Example usage

use Gt\CssXPath\Translator;

$html = <<<HTML
<form>
	<label>
		Name
		<input name="name" />
	</label>
	<label>
		Code:
		<input name="code" />
	</label>
	<button name="do" value="submit">Submit code</button>
</form>
HTML;

$document = new DOMDocument();
$document->loadHTML($html);

$xpath = new DOMXPath($document);
$inputElementList = $xpath->query(new Translator("form>label>input");

About

Translate CSS selectors to XPath queries.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%