Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 46cb3b8

Browse files
committed
merged branch jfsimon/css-selector-readme-update (PR #8287)
This PR was submitted for the master branch but it was merged into the 2.3 branch instead (closes #8287). Discussion ---------- [CssSelector] added a node about HTML extension in readme It's a common mistake to use `CssSelector` with XML without knowing that `HTML` extension must be disbaled first (see #8286). This PR adds a note about that in the component's readme file. Commits ------- 4235b26 [CssSelector] added a node about HTML extension in readme
2 parents 0da84da + 0cb95e0 commit 46cb3b8

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/Symfony/Component/CssSelector/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,28 @@ equivalents:
1010

1111
print CssSelector::toXPath('div.item > h4 > a');
1212

13+
HTML and XML are different
14+
--------------------------
15+
16+
- The `CssSelector` component comes with an `HTML` extension which is enabled by default.
17+
- If you need to use this component with `XML` documents, you have to disable `HTML` extension.
18+
- `HTML` tag & attribute names are always lower-cased, with `XML` they are case-sensistive.
19+
20+
Disable & enable `HTML` extension:
21+
22+
// disable `HTML` extension:
23+
CssSelector::disableHtmlExtension();
24+
// re-enable `HTML` extension:
25+
CssSelector::enableHtmlExtension();
26+
27+
What brings `HTML` extension?
28+
- Tag names are lower-cased
29+
- Attribute names are lower-cased
30+
- Adds following pseudo-classes:
31+
- `checked`, `link`, `disabled`, `enabled`, `selected`: used with form tags
32+
- `invalid`, `hover`, `visited`: always select nothing
33+
- Adds `lang()` function
34+
1335
Resources
1436
---------
1537

0 commit comments

Comments
 (0)