Update xpath

This commit is contained in:
Rico Sta. Cruz 2015-04-17 15:47:14 +08:00
parent 35667e6a10
commit 1c58b53a45
1 changed files with 3 additions and 3 deletions

View File

@ -24,7 +24,7 @@ layout: default
### Attribute selectors ### Attribute selectors
| CSS | Xpath | ? | | CSS | Xpath | ? |
| --- | --- | | | --- | --- | --: |
| `#id` | `//[@id="id"]` | [?](#predicates) | | `#id` | `//[@id="id"]` | [?](#predicates) |
| `.class` | `//[@class="class"]` *...see below* | | | `.class` | `//[@class="class"]` *...see below* | |
| `input[type="submit"]` | `//input[@type="submit"]` | | | `input[type="submit"]` | `//input[@type="submit"]` | |
@ -36,7 +36,7 @@ layout: default
### Order selectors ### Order selectors
| CSS | Xpath | ? | | CSS | Xpath | ? |
| --- | --- | -- | | --- | --- | --: |
| `ul > li:first-child` | `//ul/li[1]` | [?](#indexing) | | `ul > li:first-child` | `//ul/li[1]` | [?](#indexing) |
| `ul > li:nth-child(2)` | `//ul/li[2]` | | | `ul > li:nth-child(2)` | `//ul/li[2]` | |
| `ul > li:last-child` | `//ul/li[last()]` | | | `ul > li:last-child` | `//ul/li[last()]` | |
@ -50,7 +50,7 @@ layout: default
### jQuery ### jQuery
| jQuery | Xpath | ? | | jQuery | Xpath | ? |
| ------ | --- | -- | | ------ | --- | --: |
| `$('ul > li').parent()` | `//ul/li/..` | [?](#other-axes) | | `$('ul > li').parent()` | `//ul/li/..` | [?](#other-axes) |
| `$('li').closest('section')` | `//li/ancestor-or-self::section` | | | `$('li').closest('section')` | `//li/ancestor-or-self::section` | |
| ---- | ---- | | | ---- | ---- | |