Skip to content

Commit 751c78c

Browse files
Minor fixes
1 parent fdaab5c commit 751c78c

File tree

3 files changed

+627
-352
lines changed

3 files changed

+627
-352
lines changed

demo.php

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
require('phpQuery/phpQuery.php');
34

45
// INITIALIZE IT
@@ -19,12 +20,9 @@
1920
// MANIPULATE IT
2021
$li = null;
2122
// almost everything can be a chain
22-
$doc['ul > li']
23-
->addClass('my-new-class')
24-
->filter(':last')
25-
->addClass('last-li')
23+
$doc['ul > li']->addClass('my-new-class')->filter(':last')->addClass('last-li')
2624
// save it anywhere in the chain
27-
->toReference($li);
25+
->toReference($li);
2826

2927
// SELECT DOCUMENT
3028
// pq(); is using selected document as default
@@ -36,11 +34,11 @@
3634
// ITERATE IT
3735
// all direct LIs from $ul
3836
foreach($ul['> li'] as $li) {
39-
// iteration returns PLAIN dom nodes, NOT phpQuery objects
40-
$tagName = $li->tagName;
41-
$childNodes = $li->childNodes;
42-
// so you NEED to wrap it within phpQuery, using pq();
43-
pq($li)->addClass('my-second-new-class');
37+
// iteration returns PLAIN dom nodes, NOT phpQuery objects
38+
$tagName = $li->tagName;
39+
$childNodes = $li->childNodes;
40+
// so you NEED to wrap it within phpQuery, using pq();
41+
pq($li)->addClass('my-second-new-class');
4442
}
4543

4644
// PRINT OUTPUT

0 commit comments

Comments
 (0)