|
2 | 2 | single: CssSelector
|
3 | 3 | single: Components; CssSelector
|
4 | 4 |
|
5 |
| -The CssSelector Component |
6 |
| -========================= |
| 5 | +Komponenta CssSelector |
| 6 | +====================== |
7 | 7 |
|
8 |
| - The CssSelector component converts CSS selectors to XPath expressions. |
| 8 | + Komponenta CssSelector pretvarja CSS izbirnike v izraze XPath. |
9 | 9 |
|
10 |
| -Installation |
11 |
| ------------- |
| 10 | +Namestitev |
| 11 | +---------- |
12 | 12 |
|
13 |
| -You can install the component in 2 different ways: |
| 13 | +Komponento lahko namestite na 2 različna načina: |
14 | 14 |
|
15 |
| -* :doc:`Install it via Composer </components/using_components>` (``symfony/css-selector`` on `Packagist`_); |
16 |
| -* Use the official Git repository (https://github.com/symfony/CssSelector). |
| 15 | +* :doc:`Namestite jo preko Composer-ja </components/using_components>` (``symfony/css-selector`` na `Packagist`_); |
| 16 | +* Uporabite uradni Git repozitorij (https://github.com/symfony/CssSelector). |
17 | 17 |
|
18 |
| -Usage |
19 |
| ------ |
| 18 | +Uporaba |
| 19 | +------- |
20 | 20 |
|
21 |
| -Why to Use CSS selectors? |
22 |
| -~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 21 | +Zakaj uporabiti CSS izbirnike? |
| 22 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
23 | 23 |
|
24 |
| -When you're parsing an HTML or an XML document, by far the most powerful |
25 |
| -method is XPath. |
| 24 | +Ko razčlenjujete HTML ali XML dokument, je daleč najmočnejša |
| 25 | +metoda XPath. |
26 | 26 |
|
27 |
| -XPath expressions are incredibly flexible, so there is almost always an |
28 |
| -XPath expression that will find the element you need. Unfortunately, they |
29 |
| -can also become very complicated, and the learning curve is steep. Even common |
30 |
| -operations (such as finding an element with a particular class) can require |
31 |
| -long and unwieldy expressions. |
| 27 | +Izrazi XPath so izjemno fleksibilni, zato je skoraj vedno |
| 28 | +izraz XPath, ki bo našel element, ki ga potrebujete. Na žalost |
| 29 | +lahko postanejo tudi zelo komplicirani in krivulja učenja je strma. Celo pogoste |
| 30 | +operacije (kot je najdenje elementa z določenim razredom) lahko zahteva |
| 31 | +dolge in nepriročne izraze. |
32 | 32 |
|
33 |
| -Many developers -- particularly web developers -- are more comfortable |
34 |
| -using CSS selectors to find elements. As well as working in stylesheets, |
35 |
| -CSS selectors are used in JavaScript with the ``querySelectorAll`` function |
36 |
| -and in popular JavaScript libraries such as jQuery, Prototype and MooTools. |
| 33 | +Mnogi razvijalci -- posebno spletni razvijalci -- so bolj domači |
| 34 | +pri uporabi CSS izbirnikov, da najdejo elemente. Kot tudi delo na stilih, |
| 35 | +so CSS izbirniki uporabljeni v JavaScript-u s funkcijo ``querySelectorAll`` |
| 36 | +in v popularnih JavaScript knjižnicah kot je jQuery, Prototype in MooTools. |
37 | 37 |
|
38 |
| -CSS selectors are less powerful than XPath, but far easier to write, read |
39 |
| -and understand. Since they are less powerful, almost all CSS selectors can |
40 |
| -be converted to an XPath equivalent. This XPath expression can then be used |
41 |
| -with other functions and classes that use XPath to find elements in a |
42 |
| -document. |
| 38 | +CSS izbirniki so manj močnejši kot XPath, vendar bolj enostavni za pisanje, branje |
| 39 | +in razumevanje. Ker so manj močnejši, so lahko skoraj vsi CSS izbirniki |
| 40 | +pretvorjeni v enakovreden XPath. Ta izraz XPath je lahko potem uporabljen |
| 41 | +z drugimi funkcijami in razredi, ki uporabljajo XPath, da najdejo elemente v |
| 42 | +dokumentu. |
43 | 43 |
|
44 |
| -The CssSelector Component |
45 |
| -~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 44 | +Komponenta CssSelector |
| 45 | +~~~~~~~~~~~~~~~~~~~~~~ |
46 | 46 |
|
47 |
| -The component's only goal is to convert CSS selectors to their XPath |
48 |
| -equivalents:: |
| 47 | +Edini cilj komponente je pretvorba izbirnikov CSS v njihove XPath |
| 48 | +ekvivalente:: |
49 | 49 |
|
50 | 50 | use Symfony\Component\CssSelector\CssSelector;
|
51 | 51 |
|
52 | 52 | print CssSelector::toXPath('div.item > h4 > a');
|
53 | 53 |
|
54 |
| -This gives the following output: |
| 54 | +To da sledeči izpis: |
55 | 55 |
|
56 | 56 | .. code-block:: text
|
57 | 57 |
|
58 | 58 | descendant-or-self::div[@class and contains(concat(' ',normalize-space(@class), ' '), ' item ')]/h4/a
|
59 | 59 |
|
60 |
| -You can use this expression with, for instance, :phpclass:`DOMXPath` or |
61 |
| -:phpclass:`SimpleXMLElement` to find elements in a document. |
| 60 | +Ta izraz lahko uporabite skupaj z, na primer, :phpclass:`DOMCPath` ali |
| 61 | +:phpclass:`SimpleXMLElement`, da najdete elemente v dokumentu. |
62 | 62 |
|
63 | 63 | .. tip::
|
64 | 64 |
|
65 |
| - The :method:`Crawler::filter() <Symfony\\Component\\DomCrawler\\Crawler::filter>` method |
66 |
| - uses the CssSelector component to find elements based on a CSS selector |
67 |
| - string. See the :doc:`/components/dom_crawler` for more details. |
| 65 | + Metoda :method:`Crawler::filter() <Symfony\\Component\\DomCrawler\\Crawler::filter>` |
| 66 | + uporablja komponento CssSelector, da najde elemente na osnovi niza CSS izbirnika. |
| 67 | + Glejte :doc:`/components/dom_crawler` za več podrobnosti. |
68 | 68 |
|
69 |
| -Limitations of the CssSelector Component |
70 |
| -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 69 | +Omejitve komponente CssSelector |
| 70 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
71 | 71 |
|
72 |
| -Not all CSS selectors can be converted to XPath equivalents. |
| 72 | +Vsi izbirniki CSS ne morejo biti pretvorjeni v XPath ekvivalente. |
73 | 73 |
|
74 |
| -There are several CSS selectors that only make sense in the context of a |
75 |
| -web-browser. |
| 74 | +Na voljo je nekaj izbirnikov CSS, ki imajo smisel samo v kontekstu |
| 75 | +spletnega brskalnika. |
76 | 76 |
|
77 |
| -* link-state selectors: ``:link``, ``:visited``, ``:target`` |
78 |
| -* selectors based on user action: ``:hover``, ``:focus``, ``:active`` |
79 |
| -* UI-state selectors: ``:invalid``, ``:indeterminate`` (however, ``:enabled``, |
80 |
| - ``:disabled``, ``:checked`` and ``:unchecked`` are available) |
| 77 | +* izbirniki link-state: ``:link``, ``:visited``, ``:target`` |
| 78 | +* izbirniki na osnovi akcije uporabnika: ``:hover``, ``:focus``, ``:active`` |
| 79 | +* izbirniki UI-state: ``:invalid``, ``:indeterminate`` (vendar, ``:enabled``, |
| 80 | + ``:disabled``, ``:checked`` in ``:unchecked`` so na voljo) |
81 | 81 |
|
82 |
| -Pseudo-elements (``:before``, ``:after``, ``:first-line``, |
83 |
| -``:first-letter``) are not supported because they select portions of text |
84 |
| -rather than elements. |
| 82 | +Psevdo elementi (``:before``, ``:after``, ``:first-line``, |
| 83 | +``:first-letter``) niso podprti, ker izbirajo dele tekstov, |
| 84 | +namesto elementov. |
85 | 85 |
|
86 |
| -Several pseudo-classes are not yet supported: |
| 86 | +Nekaj psevdo-razredov še ni podprtih: |
87 | 87 |
|
88 | 88 | * ``*:first-of-type``, ``*:last-of-type``, ``*:nth-of-type``,
|
89 |
| - ``*:nth-last-of-type``, ``*:only-of-type``. (These work with an element |
90 |
| - name (e.g. ``li:first-of-type``) but not with ``*``. |
| 89 | + ``*:nth-last-of-type``, ``*:only-of-type``. (Te delujejo z imenom |
| 90 | + elementa (npr. ``li:first-of-type``) vendar ne z ``*``. |
91 | 91 |
|
92 | 92 | .. _Packagist: https://packagist.org/packages/symfony/css-selector
|
0 commit comments