Bug Tracker

Opened 7 years ago

Closed 7 years ago

#12458 closed bug (wontfix)

Error in IE8 when asigning property with prop() method

Reported by: anonymous Owned by:
Priority: low Milestone: None
Component: attributes Version: 1.8.1
Keywords: Cc:
Blocked by: Blocking:

Description

Here is a fiddle: http://jsfiddle.net/Q9YDq/2/

Line in JQuery, that causes error: return ( elem[ name ] = value );

This one seem to fail in JQuery since 1.7.1 at least

<<HTML<<
<input type="text" id="check"/><br/> <input type="button" value="crash IE8!">

<<JS<<
$('input[type=button]').click(function(){ $('#check').val(5).prop('type', 'hidden'); });

Change History (1)

comment:1 Changed 7 years ago by timmywil

Component: unfiledattributes
Priority: undecidedlow
Resolution: wontfix
Status: newclosed

The .attr() method can be used to set the content attribute on element creation, but type cannot be set in IE once the element has been created. If you were to use .attr(), jQuery simply throws an error in all browsers. Whether we do this in .prop() is debatable. I prefer to keep .prop() raw and low-level and rely on the user to know how to manipulate properties because there are exponentially more factors in dealing with properties.

Note: See TracTickets for help on using tickets.