开发者

webkit problem printing XPathResults, need workaround

开发者 https://www.devze.com 2023-02-07 07:57 出处:网络
I\'m using the following code... var result = document.evaluate(expr,context,null,9,null); When printing the result I get the following error...

I'm using the following code...

 var result = document.evaluate(expr,context,null,9,null);

When printing the result I get the following error...

Error: TYPE_ERR: DOM XPath Exception 52

This appears to be an issue with webkit in general as evident from the following issue...

http://code.google.com/p/chromium/issues/detail?id=68770

I'm wondering, does anyone know of a workaround way I can make this work? The work around need only suit just webkit. It does not needed to work in Firefox, IE, etc.

NOTE: I myself am working with Google Chrome but I've included the other popular applications which use webkit since this issue is relevant to them too.

EDIT: Same result when I call screenshotLength() on result.

EDIT 2

var result = document.evaluate(expr,context,null,XPathResult.FIRST_开发者_Python百科ORDERED_NODE_TYPE,null).singleNodeValue;

Appears to produce undefined


Ah! It wasn't webkit but rather the way I was calling this function. All document.evaluate calls in Chrome shouldn't be made in the background.html. Worked from a content script for me.

0

精彩评论

暂无评论...
验证码 换一张
取 消