Opera Presto provides support for the Selectors API Level 1.
NodeSelector interfaceThe NodeSelector interface is implemented by objects implmenting the following interfaces:
DocumentDocumentFragmentElementOpera Presto's support is described in the following data table.
| Method | Description | Support |
|---|---|---|
querySelector()
|
|
Yes |
querySelectorAll()
|
|
Yes |
This is an example table written in HTML 4.01.
<table id="score">
<thead>
<tr>
<th>Test
<th>Result
<tfoot>
<tr>
<th>Average
<td>82%
<tbody>
<tr>
<td>A
<td>87%
<tr>
<td>B
<td>78%
<tr>
<td>C
<td>81%
</table>
In order to obtain the cells containing the results in the table, the following selector query may be used.
var cells = document.querySelectorAll("#score>tbody>tr>td:nth-of-type(2)");
This example returns a node list containing each of the cells in the second column. This could be useful, for example, to plot the values on a graph.
The Selector API baseline test case is composed of 1008 individual tests. Opera Presto registers a 100% pass rate when the test case is run. For your reference, the test case can be run here: W3C Baseline Tests: HTML with CSS Level 2.1 Selectors.
Need help? Hit F1 anytime while using Opera to access our online help files, or go here.