Given this XML in data.xml
<?xml version="1.0" encoding="utf-8"?>
<data>
<bar>100</bar>
</data>
I want to display the content from the "bar" element using the following code in test.html
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
$.get('data.xml', function(xml) {
var foo = $(xml).find('bar').text();
document.write("<span>foo: [" + foo + "]</span>");
});
</script>
</body>
</html>
The output in webkit based browsers:
foo: [100]
The output in IE8 on XP:
foo: []
Why do webkit browsers read the element's content correctly while IE8 interprets it as an empty string?