Skip to main content

Bug Tracker

Side navigation

#15190 closed bug (notabug)

Opened July 21, 2014 10:26AM UTC

Closed July 21, 2014 05:52PM UTC

Cannot get or set custom properties

Reported by: Evert Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.11.1
Keywords: Cc:
Blocked by: Blocking:
Description

First things first, I've searched for similar tickets and yes I found the one were somebody confused props with attributes. I am not making the same mistake here.

http://jsfiddle.net/PHqS9/2/

It does work with .attr('prop', 'prop') but I don't want to add prop="prop" to the element, I just want to add prop.

Attachments (0)
Change History (1)

Changed July 21, 2014 05:52PM UTC by gibson042 comment:1

_comment0: > I found the one were somebody confused props with attributes. I am not making the same mistake here. \ \ I'm afraid you are, because `[…]` [http://api.jquery.com/category/selectors/attribute-selectors/ selectors] target attributes, not properties. And only properties recognized as [http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#boolean-attributes boolean] by the client lack a proper string value. You can, however, adopt a convention for indicating truth/falsehood and check for your expected value with `[attr="<true value>"]` or `[attr!="<false value>"]`, respectively.1405966906475462
resolution: → notabug
status: newclosed
I found the one were somebody confused props with attributes. I am not making the same mistake here.

I'm afraid you are, because […] selectors target attributes, not properties. And only attributes recognized as boolean by the client lack a proper string value. You can, however, adopt a convention for indicating truth/falsehood and check for your expected value with [attr="<true value>"] or [attr!="<false value>"], respectively.