xpath and doc.setProperty problems with IE9

531 views
Skip to first unread message

KajMagnus

unread,
Oct 5, 2011, 3:07:29 AM10/5/11
to SVG Web
Hi,

With IE9, a call to doc.setProperty throws a property-not-supported
error. In my case I've found a workaround. I'm posting this anyway (I
wrote the email before I found my workaround), in case it's a bug
someone wants to fix, or in case someone finds the workaround useful.

Details: In this function: (in svg.js)

function xpath(doc, context, expr, namespaces) {

the call to doc.setProperty fails: (always, as far as I can tell)

if (typeof XPathEvaluator != 'undefined') { // non-IE browsers
...
} else { // IE
doc.setProperty('SelectionLanguage', 'XPath'); <---- fails

With this error:
Object doesn't support property or method 'setProperty'

(IE9 is running in "Browser Mode: IE9 Document Mode: IE9 standards",
says IE9's debugger.
I'm using svgweb-2011-02-03-Lurker-Above.)


For me, the `doc.setProperty' code seems to run if and only if 1) I
select an element like so: jQuery('#element-id'), and 2) the element
searched for does not exist. Perhaps that's why fairly few people
have noticed this error? Few people search for #elems that might not
yet exist?

A workaround is, in my case, to search like so:
jQuery('body').find('#perhaps-non-existing-elem')
instead of jQuery('#perhaps-non-existing-elem'), because then the
doc.setProperty code never runs.

I found an old thread from February 2011:
http://groups.google.com/group/svg-web/browse_thread/thread/55629a8b43c52497,
someone else has/had the exact same problem; no solution is mentioned
though. (The error happens on line 1 column 319 for me too, in the
minified svg.js.)

Best regards, KajMagnus
Reply all
Reply to author
Forward
0 new messages