-
Notifications
You must be signed in to change notification settings - Fork 20
Query PrevAll
Thomas Weinert edited this page Jul 31, 2014
·
1 revision
FluentDOM\Query prevAll([ string $selector = NULL ])
Find all sibling elements before the current element.
$html = <<<HTML
<html>
<head>
<title>Examples: FluentDOM\Query::prevAll()</title>
</head>
<body>
<div><span>has child</span></div>
<div id="start"> </div>
<div> </div>
<div><span>has child</span></div>
<div class="here"><span>has child</span></div>
<div><span>has child</span></div>
<div class="here"> </div>
<div> </div>
<p><button>Go to Prev</button></p>
</body>
</html>
HTML;
echo FluentDOM($html)
->find('//div[@id = "start"]')
->prevAll()
->addClass('before');
<?xml version="1.0"?>
<html>
<head>
<title>Examples: FluentDOM\Query::prevAll()</title>
</head>
<body>
<div class="before"><span>has child</span></div>
<div id="start"> </div>
<div> </div>
<div><span>has child</span></div>
<div class="here"><span>has child</span></div>
<div><span>has child</span></div>
<div class="here"> </div>
<div> </div>
<p><button>Go to Prev</button></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