Bug Tracker

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#12895 closed bug (notabug)

Find does not find element in IE 9

Reported by: geigerk@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.8.1
Keywords: Cc:
Blocked by: Blocking:

Description

The best way to describe this bug is show code that illustrates it:

<head>
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript">
$(function() {
	$("#_edit_form").find("#test_field").val("TESTIT");
	$("#_edit_form2").find("#test_field2").val("TESTIT2");
	$("#_edit_form3").find("#test_field3").val("TESTIT3");
});
</script>
</head>
<body>

<p>
<form id="_edit_form" name="_edit_form">
<table>
<tr>
	<td><input type="text" name="test_field" id="test_field" size="25" value="" /></td>
</tr>
</table>
</form>
</p>

<p>
<form id="_edit_form2" name="_edit_form2">
<input type="text" name="test_field2" id="test_field2" size="25" value="" />
</form>
</p>

<form id="_edit_form3" name="_edit_form3">
<table>
<tr>
	<td><input type="text" name="test_field3" id="test_field3" size="25" value="" /></td>
</tr>
</table>
</form>

</body>

This simply creates 3 input fields and JQuery sets the values of each. In IE 9, the first one does not get set because JQuery doesn't find it. Something about the combination of <p> and <table> causes JQuery to not find the field. Removing either the <p> or <table> fixes the problem, as illustrated in the 2nd and 3rd fields. All three work in Safari, Chrome, Firefox and IE 8.

Change History (2)

comment:1 Changed 7 years ago by timmywil

Resolution: notabug
Status: newclosed

The html is invalid. p tags can only include "phrasing content", which does not include table tags: http://dev.w3.org/html5/spec/content-models.html#phrasing-content-1.

comment:2 Changed 7 years ago by anonymous

Ok, I understand, however, it begs two questions: 1) why does JQuery work in this context in every browser except IE 9? and 2) why does every browser render it the way one would expect it to look were it valid?

Note: See TracTickets for help on using tickets.