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
This commit is contained in:
commit
46cb3b8095
|
@ -10,6 +10,28 @@ equivalents:
|
||||||
|
|
||||||
print CssSelector::toXPath('div.item > h4 > a');
|
print CssSelector::toXPath('div.item > h4 > a');
|
||||||
|
|
||||||
|
HTML and XML are different
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
- The `CssSelector` component comes with an `HTML` extension which is enabled by default.
|
||||||
|
- If you need to use this component with `XML` documents, you have to disable `HTML` extension.
|
||||||
|
- `HTML` tag & attribute names are always lower-cased, with `XML` they are case-sensistive.
|
||||||
|
|
||||||
|
Disable & enable `HTML` extension:
|
||||||
|
|
||||||
|
// disable `HTML` extension:
|
||||||
|
CssSelector::disableHtmlExtension();
|
||||||
|
// re-enable `HTML` extension:
|
||||||
|
CssSelector::enableHtmlExtension();
|
||||||
|
|
||||||
|
What brings `HTML` extension?
|
||||||
|
- Tag names are lower-cased
|
||||||
|
- Attribute names are lower-cased
|
||||||
|
- Adds following pseudo-classes:
|
||||||
|
- `checked`, `link`, `disabled`, `enabled`, `selected`: used with form tags
|
||||||
|
- `invalid`, `hover`, `visited`: always select nothing
|
||||||
|
- Adds `lang()` function
|
||||||
|
|
||||||
Resources
|
Resources
|
||||||
---------
|
---------
|
||||||
|
|
||||||
|
|
Reference in New Issue