Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/css-selector/XPath/Extension/PseudoClassExtension.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 4c8ae668cc8c |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
13:5fb285c0d0e3 | 14:1fec387a4317 |
---|---|
42 'empty' => array($this, 'translateEmpty'), | 42 'empty' => array($this, 'translateEmpty'), |
43 ); | 43 ); |
44 } | 44 } |
45 | 45 |
46 /** | 46 /** |
47 * @param XPathExpr $xpath | |
48 * | |
49 * @return XPathExpr | 47 * @return XPathExpr |
50 */ | 48 */ |
51 public function translateRoot(XPathExpr $xpath) | 49 public function translateRoot(XPathExpr $xpath) |
52 { | 50 { |
53 return $xpath->addCondition('not(parent::*)'); | 51 return $xpath->addCondition('not(parent::*)'); |
54 } | 52 } |
55 | 53 |
56 /** | 54 /** |
57 * @param XPathExpr $xpath | |
58 * | |
59 * @return XPathExpr | 55 * @return XPathExpr |
60 */ | 56 */ |
61 public function translateFirstChild(XPathExpr $xpath) | 57 public function translateFirstChild(XPathExpr $xpath) |
62 { | 58 { |
63 return $xpath | 59 return $xpath |
65 ->addNameTest() | 61 ->addNameTest() |
66 ->addCondition('position() = 1'); | 62 ->addCondition('position() = 1'); |
67 } | 63 } |
68 | 64 |
69 /** | 65 /** |
70 * @param XPathExpr $xpath | |
71 * | |
72 * @return XPathExpr | 66 * @return XPathExpr |
73 */ | 67 */ |
74 public function translateLastChild(XPathExpr $xpath) | 68 public function translateLastChild(XPathExpr $xpath) |
75 { | 69 { |
76 return $xpath | 70 return $xpath |
78 ->addNameTest() | 72 ->addNameTest() |
79 ->addCondition('position() = last()'); | 73 ->addCondition('position() = last()'); |
80 } | 74 } |
81 | 75 |
82 /** | 76 /** |
83 * @param XPathExpr $xpath | |
84 * | |
85 * @return XPathExpr | 77 * @return XPathExpr |
86 * | 78 * |
87 * @throws ExpressionErrorException | 79 * @throws ExpressionErrorException |
88 */ | 80 */ |
89 public function translateFirstOfType(XPathExpr $xpath) | 81 public function translateFirstOfType(XPathExpr $xpath) |
96 ->addStarPrefix() | 88 ->addStarPrefix() |
97 ->addCondition('position() = 1'); | 89 ->addCondition('position() = 1'); |
98 } | 90 } |
99 | 91 |
100 /** | 92 /** |
101 * @param XPathExpr $xpath | |
102 * | |
103 * @return XPathExpr | 93 * @return XPathExpr |
104 * | 94 * |
105 * @throws ExpressionErrorException | 95 * @throws ExpressionErrorException |
106 */ | 96 */ |
107 public function translateLastOfType(XPathExpr $xpath) | 97 public function translateLastOfType(XPathExpr $xpath) |
114 ->addStarPrefix() | 104 ->addStarPrefix() |
115 ->addCondition('position() = last()'); | 105 ->addCondition('position() = last()'); |
116 } | 106 } |
117 | 107 |
118 /** | 108 /** |
119 * @param XPathExpr $xpath | |
120 * | |
121 * @return XPathExpr | 109 * @return XPathExpr |
122 */ | 110 */ |
123 public function translateOnlyChild(XPathExpr $xpath) | 111 public function translateOnlyChild(XPathExpr $xpath) |
124 { | 112 { |
125 return $xpath | 113 return $xpath |
127 ->addNameTest() | 115 ->addNameTest() |
128 ->addCondition('last() = 1'); | 116 ->addCondition('last() = 1'); |
129 } | 117 } |
130 | 118 |
131 /** | 119 /** |
132 * @param XPathExpr $xpath | |
133 * | |
134 * @return XPathExpr | 120 * @return XPathExpr |
135 * | 121 * |
136 * @throws ExpressionErrorException | 122 * @throws ExpressionErrorException |
137 */ | 123 */ |
138 public function translateOnlyOfType(XPathExpr $xpath) | 124 public function translateOnlyOfType(XPathExpr $xpath) |
143 | 129 |
144 return $xpath->addCondition('last() = 1'); | 130 return $xpath->addCondition('last() = 1'); |
145 } | 131 } |
146 | 132 |
147 /** | 133 /** |
148 * @param XPathExpr $xpath | |
149 * | |
150 * @return XPathExpr | 134 * @return XPathExpr |
151 */ | 135 */ |
152 public function translateEmpty(XPathExpr $xpath) | 136 public function translateEmpty(XPathExpr $xpath) |
153 { | 137 { |
154 return $xpath->addCondition('not(*) and not(string-length())'); | 138 return $xpath->addCondition('not(*) and not(string-length())'); |