Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#7205 closed defect (fixed)

dojo.query fails to detect case sensitive document on ff3

Reported by: ptwobrussell Owned by: alex
Priority: high Milestone: 1.2
Component: Query Version: 1.1.1
Keywords: Cc: ptwobrussell@…
Blocked By: Blocking:

Description

Currently in r14444, I'm finding that dojo.query fails if you provide an xml document context that has tags in all lower case. If you track it down, you find that it's because caseSensitive=false when qparts is returned so even though you might be querying for "foo", it gets normalized to "FOO", which doesn't exist in the document; rather, "foo" exists in the document.

It seems that caseSensitive is determined around line 1224 and the issue that I'm seeing is that od.ownerDocument is undefined, which results in the caseSensitive = (!!od) && (d.isIE ? od.xml : od.xmlVersion); expression evaulating to false when it should be evaulating to true

I have no idea if this is a good idea or not, but it seems that you might check if od.contentType equals "application/xml" or if od.xmlVersion is defined or something along those lines to clear this up?

For a test doc, I'm finding that something as simple as

<?xml version="1.0" encoding="UTF-8"?>
<foo><bar id="blarg" /></foo>

allows you to reproduce this issue. So, load that document up with something like the following to reproduce:

                    var dfd = dojo.xhrGet({
                         url : "foo.xml",
                         handleAs : "xml"
                    });

                    dfd.addCallback(function(response, io) {
                        console.log(dojo.query("foo", response));
                        return response;

                    });

Change History (5)

comment:1 Changed 11 years ago by ptwobrussell

And by od.contentType, I actually meant root.contentType.

So, for example, this works though it might not best the best idea in the world:

caseSensitive = (root.contentType && root.contentType=="application/xml") || (!!od) && (d.isIE ? od.xml : od.xmlVersion);

comment:2 Changed 11 years ago by Adam Peller

Owner: changed from anonymous to alex

comment:3 Changed 11 years ago by alex

Resolution: fixed
Status: newclosed

(In [14546]) fixes #7205. Ensures that we detect case sensitivity correctly on XML documents in FF and Safari when they're passed in directly as the root. !strict

comment:4 Changed 11 years ago by bill

Milestone: tbd1.2

comment:5 Changed 10 years ago by bill

Component: CoreQuery
Note: See TracTickets for help on using tickets.