Bug Tracker

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#12443 closed bug (invalid)

prop() Bug in IE9

Reported by: ganhuan@… Owned by:
Priority: undecided Milestone: None
Component: attributes Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:

Description

html code :

<div hidden="true"> </div>

when using $.prop("hidden") in IE 9,it returns "undefined",but other brower such as firefox\IE 7\IE 8\Chrome returns "true" as expected. <a href="http://jsfiddle.net/Ap2L4/">code in jsFiddle</a>

Change History (5)

comment:1 Changed 6 years ago by timmywil

Component: unfiledattributes
Resolution: invalid
Status: newclosed

prop is a low-level method that returns whatever the property value is in the browser. Although results may be different in different browsers, manipulation of these values would be disastrous.

comment:2 Changed 6 years ago by dmethvin

The current result seems like a beneficial feature to me anyway, it's pretty clear from it that IE9 does not support the HTML5 hidden attribute. I can't see why we'd want to shim the property and mask the browser's lack of support for it.

http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#the-hidden-attribute

comment:3 in reply to:  2 Changed 6 years ago by ganhuan@…

Thanks for your request,but the problem is that I change the attribute "hidden" to any other name , for example "notShow","ab" and so on,it doesn't work in ie 9 any more.At contrast, if i use getAttribute("hidden") of dom,i can get the value of "hidden",see code below. Code :alert($("#test").get(0).getAttribute("hidden"));

comment:4 in reply to:  2 Changed 6 years ago by ganhuan@…

Replying to dmethvin:

The current result seems like a beneficial feature to me anyway, it's pretty clear from it that IE9 does not support the HTML5 hidden attribute. I can't see why we'd want to shim the property and mask the browser's lack of support for it.

http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#the-hidden-attribute

I set the attrbuite "hidden"(other name else) to div is that i want get the configuration data from html elements for some jquery plug in like jqgrid.

comment:5 Changed 6 years ago by dmethvin

HTML doesn't map all attributes to properties by default, only a small number of them. If you want the attribute, use .attr() and not .prop(). http://jsfiddle.net/Ap2L4/1/

Note: See TracTickets for help on using tickets.