Side navigation
#12732 closed feature (duplicate)
Opened October 15, 2012 02:34PM UTC
Closed October 15, 2012 03:53PM UTC
hasAttr
Reported by: | markel | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | None |
Component: | attributes | Version: | 1.8.2 |
Keywords: | 1.9-discuss | Cc: | |
Blocked by: | Blocking: |
Description
This is duplicate of #4324 and #9396. You already voted on #9396, deciding to say no, but i was told to bring this up again, when 1.9 will be around the corner.
To summarize –
Pros
- It's faster then jQuery#attr – http://jsperf.com/attr-vs-hasattr
- This is a commonly requested feature
- Because it's faster, it could be used inside jQuery or in jQuery plugin, for example – http://bugs.jquery.com/ticket/10463
- It would make good pair for jQuery#hasClass
- Use of jQuery#hasAttr is more clearer then though jQuery#attr method
Cons
- Yes it's faster, but in what real world application it could be a bottleneck?
- One more method to support and maintain
- Hit on size (75 bytes)
Attachments (0)
Change History (6)
Changed October 15, 2012 02:48PM UTC by comment:1
component: | unfiled → attributes |
---|---|
keywords: | → 1.9-discuss |
priority: | undecided → low |
status: | new → open |
version: | git → 1.8.2 |
Changed October 15, 2012 02:48PM UTC by comment:2
+0
Changed October 15, 2012 02:49PM UTC by comment:3
In 2.0, the native .hasAttribute would work fine. However, if we want to make it "jQueryified", we could wrap it in hasAttr with an each. If we do that though, we should have the same, but cross-browser, API in 1.9. I'm fine either way.
Changed October 15, 2012 02:51PM UTC by comment:4
+0, I like small, but I also like fast.
Changed October 15, 2012 03:36PM UTC by comment:5
i tried to make it as small as possible, i hope those 75 bytes would not be a deciding point in this.
Given that some edge-cases bugs take up to 40 bytes and all those gibson optimizations and future deprecated stuff that will be removed in 1.9 and a lot (a lot) of stuff that will be removed in 2.0 will give some perspective.