webkit打印XPathResults问题,需要解决方法 [英] webkit problem printing XPathResults, need workaround

查看:52
本文介绍了webkit打印XPathResults问题,需要解决方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下代码...

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

从以下问题可以明显看出,这通常是webkit的问题...

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

我想知道,有人知道我可以执行此工作的替代方法吗?解决方法仅适合于Webkit.不需要在Firefox,IE等中运行.

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.

注意::我本人正在使用Google Chrome浏览器,但是我也包括了其他使用webkit的流行应用程序,因为此问题也与它们有关.

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.

编辑:当我在 result 上调用 screenshotLength()时,结果相同.

Same result when I call screenshotLength() on result.

编辑2

var result = document.evaluate(expr,context,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;

似乎产生 undefined

推荐答案

啊!不是webkit,而是我调用此函数的方式.Chrome中的所有 document.evaluate 调用均不应在 background.html 中进行.为我使用了内容脚本.

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.

这篇关于webkit打印XPathResults问题,需要解决方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆