Permalink
Browse files

Add IS_XPATH_POSITION_FUNCTION_BUGGY test (XPath's `position()` funct…

…ion can be used to imlpement `*-of-type` selectors)
  • Loading branch information...
1 parent 32e0c41 commit 1e7804b07496efcd71d06dedb97073ab7c1d37fe Juriy Zaytsev committed Apr 16, 2009
Showing with 23 additions and 1 deletion.
  1. +14 −0 feature_tests.js
  2. +9 −1 index.html
View
@@ -516,6 +516,20 @@ SOFTWARE.
return isBuggy;
})();
+ bugs.IS_XPATH_POSITION_FUNCTION_BUGGY = (bugs.__IS_XPATH_POSITION_FUNCTION_BUGGY = function(){
+ var isBuggy = false;
+ if (document.evaluate && window.XPathResult) {
+ var el = document.createElement('div');
+ el.innerHTML = '<p id="p1">a<\/p><p id="p2">b<\/p>';
+ var xpath = "//*[position() = 2]";
+ var result = document.evaluate(xpath, el, null,
+ XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
+ var isBuggy = (result.snapshotLength !== 1);
+ el = null;
+ }
+ return isBuggy;
+ })();
+
__global.__totalTime = (new Date() - t);
__global.__features = features;
View
@@ -33,7 +33,7 @@
</p>
</div>
<p>
- <span id="last-updated" class="dtstart">Last updated: Mar 25 2009</span>
+ <span id="last-updated" class="dtstart">Last updated: Apr 16 2009</span>
</p>
<h2>Features:</h2>
@@ -362,6 +362,14 @@
<td><a href="#" title="show test code" class="show-test-code">show</a></td>
</tr>
<tr style="display:none"><td colspan="5" class="test-code"><pre></pre></td></tr>
+ <tr>
+ <td>IS_XPATH_POSITION_FUNCTION_BUGGY</td>
+ <td></td>
+ <td>Safari 3+</td>
+ <td></td>
+ <td><a href="#" title="show test code" class="show-test-code">show</a></td>
+ </tr>
+ <tr style="display:none"><td colspan="5" class="test-code"><pre></pre></td></tr>
</tbody>
</table>

0 comments on commit 1e7804b

Please sign in to comment.