-
Notifications
You must be signed in to change notification settings - Fork 20
Query Siblings
Thomas Weinert edited this page Jul 30, 2014
·
1 revision
FluentDOM\Query siblings([ $selector = NULL ])
Get a set of elements containing all of the unique siblings of each of the matched set of elements.
$html = <<<HTML
<html>
<head>
<title>Examples: FluentDOM\Query::siblings()</title>
</head>
<body>
<ul>
<li>One</li>
<li>Two</li>
<li class="hilite">Three</li>
<li>Four</li>
</ul>
<ul>
<li>Five</li>
<li>Six</li>
<li>Seven</li>
</ul>
<ul>
<li>Eight</li>
<li class="hilite">Nine</li>
<li>Ten</li>
<li class="hilite">Eleven</li>
</ul>
<p>Unique siblings: <b> </b></p>
</body>
</html>
HTML;
echo FluentDOM($html)
->find('//li[@class = "hilite"]')
->siblings()
->addClass('before');
<?xml version="1.0"?>
<html>
<head>
<title>Examples: FluentDOM\Query::siblings()</title>
</head>
<body>
<ul>
<li class="before">One</li>
<li class="before">Two</li>
<li class="hilite">Three</li>
<li class="before">Four</li>
</ul>
<ul>
<li>Five</li>
<li>Six</li>
<li>Seven</li>
</ul>
<ul>
<li class="before">Eight</li>
<li class="hilite before">Nine</li>
<li class="before">Ten</li>
<li class="hilite before">Eleven</li>
</ul>
<p>Unique siblings: <b> </b></p>
</body>
</html>
- Home
- Getting Started
- Tasks
- Plugins
- Functions
- Lists
- Creator (5.1)
- CSS Selectors
- Convertors
- Loaders
- Serializers (5.1)
- Transformers (5.1)
- Extended DOM
- XMLReader (6.1)
- XMLWriter (6.1)
- Interfaces