Strange behavior mixing HTML and XML
Hello, I'm seeing strange jQuery behavior when I mix HTML and XML within the same HTML document.
I am aware of at least two workarounds which work: pull out the XML and use XHR to modify the DOM, and use E4X and embed XML into the JavaScript portion of the page. The former method is just inconvenient, in that I am doing prototyping, the resources are all small, and want to keep related resources together. The later method is rather ugly, and not terribly compatible with jQuery. (You can use jQuery selectors on an E4X XML object, but you have to serialize to a string first).
Ideally I'd be able to do this:
<doctype xhtml>
<html>
<head>
<script>
$(function(){
console.info($('p'));
console.info($('foo > bar'));
});
</script>
</head>
<body>
<p>Isn't this nice HTML?</p>
<foo> And isn't this nice XML?
<bar/>
<baz buf="blah"/>
</foo>
</body>
</html>
Is there a way for this to work? Thanks.