Bug Tracker

Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#9396 closed feature (wontfix)

.hasAttr([ element ])

Reported by: waynepurtonsmith@… Owned by:
Priority: low Milestone: 1.7
Component: attributes Version: 1.6.1
Keywords: 1.7-discuss Cc:
Blocked by: Blocking:

Description (last modified by danheberden)

.hasAttr([ element ])

Similar to .hasClass() but with the use of attributes, for example we can check whether an element has an attribute, e.g.

$('#element').hasAttr('someattribute'); return either true or false

Change History (17)

comment:1 Changed 8 years ago by john

Keywords: 1.7-discuss added

Nominating ticket for 1.7 discussion.

comment:2 Changed 8 years ago by Rick Waldron

-1, Can be achieved with existing API

comment:3 in reply to:  2 Changed 8 years ago by anonymous

Replying to rwaldron:

-1, Can be achieved with existing API

But it should be easy but implementing it - what happened to the easy writing? ;)

comment:4 Changed 8 years ago by jaubourg

Description: modified (diff)

+0,

comment:5 Changed 8 years ago by timmywil

-1, .attr('someattribute') !== undefined works fine.

comment:6 Changed 8 years ago by timmywil

Component: unfiledattributes
Description: modified (diff)
Priority: undecidedlow
Status: newopen

comment:7 Changed 8 years ago by dmethvin

-1, Bytes do not grow on trees you know.

comment:8 in reply to:  7 ; Changed 8 years ago by anonymous

Replying to dmethvin:

-1, Bytes do not grow on trees you know.

It wouldn't be that much... god...

comment:9 in reply to:  8 ; Changed 8 years ago by Rick Waldron

Replying to anonymous:

Replying to dmethvin:

-1, Bytes do not grow on trees you know.

It wouldn't be that much... god...

Feature request fulfilled: https://gist.github.com/1000671

comment:10 in reply to:  9 Changed 8 years ago by anonymous

Replying to rwaldron:

Replying to anonymous:

Replying to dmethvin:

-1, Bytes do not grow on trees you know.

It wouldn't be that much... god...

Feature request fulfilled: https://gist.github.com/1000671

That's pretty good. Would be excellent if it was implemented in the jQuery Core. :-)

comment:11 Changed 8 years ago by john

Description: modified (diff)

-1, Not really needed now that .attr("name") returns undefined if it isn't defined.

comment:12 Changed 8 years ago by addyosmani

-1

comment:13 Changed 8 years ago by ajpiano

Description: modified (diff)

-1, Not necessary

comment:14 Changed 8 years ago by danheberden

Description: modified (diff)

-1

comment:15 Changed 8 years ago by scottgonzalez

+1, can already do .is( "[someattribte]" ) but this provides good parity with .hasClass()

comment:16 Changed 8 years ago by Rick Waldron

Milestone: 1.next1.7
Resolution: wontfix
Status: openclosed

Closing per 1.7 roadmap meeting resolution

comment:17 Changed 7 years ago by Rick Waldron

#12732 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.