Side navigation
#8909 closed enhancement (fixed)
Opened April 19, 2011 12:56AM UTC
Closed September 19, 2011 08:15PM UTC
$(element).data() will scan all attributes more than needed.
Reported by: | gnarf | Owned by: | gnarf |
---|---|---|---|
Priority: | blocker | Milestone: | 1.7 |
Component: | data | Version: | 1.5.2 |
Keywords: | 1.7-discuss | Cc: | |
Blocked by: | Blocking: |
Description
If you make more than one call to
$(element).data()you end up having to loop over the attributes of the element looking for "data-" attributes every time you access it. I'd like to propose adding a simple flag in our private
_data()that can stop us from having to check more than once...
Attachments (0)
Change History (13)
Changed April 19, 2011 01:29AM UTC by comment:1
_comment0: | https://github.com/jquery/jquery/pull/335 → 1316107371653003 |
---|
Changed April 19, 2011 02:11AM UTC by comment:2
component: | unfiled → data |
---|---|
status: | new → open |
type: | bug → enhancement |
Changed April 19, 2011 09:17PM UTC by comment:3
owner: | → gnarf |
---|---|
status: | open → assigned |
Changed May 22, 2011 07:27PM UTC by comment:4
keywords: | → 1.7-discuss |
---|
Nominating ticket for 1.7 discussion.
Changed May 23, 2011 12:39AM UTC by comment:5
+0, Need some code and perf tests
Changed May 23, 2011 01:05AM UTC by comment:6
+1, If I'm reading correctly, this seems to be a performance boost
Changed May 23, 2011 04:29AM UTC by comment:7
+1,
Changed May 24, 2011 09:35PM UTC by comment:8
+1, Makes the semantics more predictable too.
Changed June 03, 2011 01:54PM UTC by comment:9
+1
Changed June 05, 2011 09:30PM UTC by comment:10
+1, Anything we can do to improve the perf of $(element).data("yesplease!")
Changed July 12, 2011 02:45PM UTC by comment:11
milestone: | 1.next → 1.7 |
---|---|
priority: | undecided → blocker |
Changed September 15, 2011 05:24PM UTC by comment:12
Updated the pull request in comment #1 - http://jsperf.com/internal-data/3 has some perf data
Changed September 19, 2011 08:15PM UTC by comment:13
resolution: | → fixed |
---|---|
status: | assigned → closed |
Landing pull request 503. 1.7 data: set a flag in the private data cache to avoid having to scan attributes multiple times - Fixes #8909.
More Details:
Changeset: 2831cfd072125a51f454346211666c9e11641474
https://github.com/jquery/jquery/pull/503