Ticket #7583 (closed bug: invalid)
strange xml attribute with IE8
| Reported by: | helfima@… | Owned by: | |
|---|---|---|---|
| Priority: | undecided | Milestone: | 1.5 |
| Component: | unfiled | Version: | 1.4.4 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description (last modified by snover) (diff)
i use a textarea for build xml and after i parse it with $() but in IE8 i have a strange result if i try to add a attribute on a node with another attribute, if the node have no attribute the result is ok. Use my script for test it, before change the javascript source.
the result: <LIST name="toto" label="Les menus"></LIST name="toto">
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript" src="./lib/js/jquery-1.4.4.min.js"></script>
<title>Insert title here</title>
</head>
<body>
<textarea id="xml"><list label="Les menus" ></list></textarea>
<script type="text/javascript" >
var text = $('#xml').text();
var xml = $(text);
xml.attr('name', 'toto');
var root = $('<root></root>');
root.append(xml);
alert(root.html());
</script>
</body>
</html>
Change History
comment:1 Changed 3 years ago by snover
- Status changed from new to closed
- Resolution set to invalid
- Description modified (diff)
comment:2 Changed 2 years ago by paul.carroll@…
if this is the case then why does jquery pass back a jquery object of the xml received after an$.ajax operation?
i only ask as i'm experiencing a null exception moving from 1.4.3 to 1.4.4 whilst working with jquery/xml and was wondering whether to log a bug and test case
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Thanks for the report, but this is not a jQuery bug. You cannot create arbitrary elements from strings in IE without a third-party compatibility library like innerShiv. Even if you use such a thing, you are likely to run into more issues, so generally speaking you simply should not try to use jQuery to operate on non-HTML documents. In the future, please use the jQuery Forum for support requests.