Pergunta

I'm using Chrome 34.0.1847.116 on Linux and if simply just load polymer.js, then document.evaluate no longer works, and returns strange error:

"Error: Failed to execute 'evaluate' on 'Document': The context node provided is null. at Error (native)

Here's an example

http://jsbin.com/jadir/2/edit?html,console,output

I'll create an issue unless I hear otherwise, but posting here in case someone has some insight.

Foi útil?

Solução

It would be helpful if you filed a bug against the ShadowDOM Polyfill.

Fwiw, you can make your example work by unwrapping the div before sending to evaluate, like this:

document.evaluate('span', unwrap(div));

... but this is a workaround and will cause other problems. For example, any nodes you extract from the result will need to be wrapped before using in most cases (wrap(node)).

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top