Operaとfirefoxでxpathの挙動が違うよ!誰のせい?誰のせい?

<html>
  <head> <title>hoge</title></head>
  <body>
	<div id="hage"></div>
	<script>
	  function f(query) {
	  try {
	  var result=document.evaluate(query,document,null,9,null).singleNodeValue.parentNode;
	  return [result,result.parentNode];
	  } catch(e) {
	  return e;
	  }
	  }
	</script>
	<p> <a href="#" onclick="alert(f('id(\'hage\')'))">id('hage')</a></p>
	<p> <a href="#" onclick="alert(f('//id(\'hage\')'))">//id('hage')</a></p>
	<p> <a href="#" onclick="alert(f('//div[id(\'hage\')]'))">//div[id('hage')]</a></p>
	<p> <a href="#" onclick="alert(f('//*[id(\'hage\')]'))">//*[id('hage')]</a></p>
  </body>
</html>

検証用
opera

  • id('hage')はXPathException
  • //id('hage')はnullが帰る
  • //div[id('hage')]は[HTMLBodyElement,HTMLHtmlElement]
  • //*[id('hage')]は[ HTMLDocument,null]

firefox

  • id('hage')は[HTMLBodyElement,HTMLHtmlElement]
  • //id('hage')はエラー(the expression is not legal expression)
  • //div[id('hage')]は[HTMLBodyElement,HTMLHtmlElement]
  • //*[id('hage')]は[ HTMLDocument,null]

よくわからないというかxpathの文法自体よくわかってない俺