Ticket #1991 (new bug)
case sensitivity in find() vs children()
| Reported by: | hubquery | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | 1.2.2 |
| Component: | core | Version: | 1.2.1 |
| Keywords: | Cc: | ||
| Needs: | Review |
Description
I was using jQuery to parse XML (actually a text string returned from an XMLHttpRequest) and found some odd behaviour when dealing with elements that weren't all lowercase. Basically find() seems to only select lowercase elements, regardless of whether the selector string is lowercase or not, while children() selects elements with no case sensitivity.
Here's an example that should illustrate the problem:
var s = document.createElement("script");
s.setAttribute("type", "text/javascript");
s.addEventListener("load", doParse, true);
s.setAttribute("src", "http://code.jquery.com/jquery-latest.js");
document.getElementsByTagName("head")[0].appendChild(s);
function doParse(){
var n = "<Test><Items><item/><Item/><Item/></Items></Test>";
var $n = $(n);
console.log($n.html());
console.log($("item", $n)); // expected 1, found 1
console.log($("Item", $n)); // expected 2, found 1
console.log($n.find("Items").children("Item")); // expected 2, found 0
console.log($n.children("Items").children("Item")); // expected 2, found 3
}
Attachments
Change History
Note: See
TracTickets for help on using
tickets.
