Ticket #7600 (closed bug: invalid)
html( htmlString ) mangles OPTION value if the value is not delimited
|Reported by:||lowell@…||Owned by:||lowell@…|
I am seeing a bug when I set the HTML contents of a tag with the jQuery .html( htmlString ) method when htmlString ends with a forward slash.
Steps to DUP. Assuming the existence of a DIV tag whose id attribute is "ndDiv", I set its HTML contents and then read what I wrote with an alert:
var html; html = '<option value="slash/">slash/</option>'; // ok $('#ndDiv').html(html); alert( $('#ndDiv').html() ); html = '<option value=slash/>slash/</option>'; // bad $('#ndDiv').html(html); alert( $('#ndDiv').html() );
The behavior is the same if the html string begins with '<select>' and ends with '</select>".
I am getting the latter ("bad") instance of the option string from the jQuery transform plugin.
I don’t know if the bug is in jQuery Transform or in jQuery core.
If the HTML specification requires that attribute values be surrounded by quotes, then the bug is in jQuery Transform, and jQuery core is just responding to bad input.
If the HTML specification does not require that attribute values be surrounded by quotes, then the bug is in jQuery core.
I am reporting this bug on the jQuery Plugins site as well.
Please advise. Thank you.