Skip to main content

Bug Tracker

Side navigation

#12895 closed bug (notabug)

Opened November 14, 2012 04:27PM UTC

Closed November 14, 2012 04:55PM UTC

Last modified November 14, 2012 09:17PM UTC

Find does not find element in IE 9

Reported by: geigerk@gmail.com 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.

Attachments (0)
Change History (2)

Changed November 14, 2012 04:55PM UTC by timmywil comment:1

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.

Changed November 14, 2012 09:17PM UTC by anonymous comment:2

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?