Skip to main content

Bug Tracker

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:

If you make more than one call to

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
that can stop us from having to check more than once...

Attachments (0)
Change History (13)

Changed April 19, 2011 01:29AM UTC by gnarf comment:1


Changed April 19, 2011 02:11AM UTC by timmywil comment:2

component: unfileddata
status: newopen
type: bugenhancement

Changed April 19, 2011 09:17PM UTC by gnarf comment:3

owner: → gnarf
status: openassigned

Changed May 22, 2011 07:27PM UTC by john comment:4

keywords: → 1.7-discuss

Nominating ticket for 1.7 discussion.

Changed May 23, 2011 12:39AM UTC by jaubourg comment:5

+0, Need some code and perf tests

Changed May 23, 2011 01:05AM UTC by rwaldron comment:6

+1, If I'm reading correctly, this seems to be a performance boost

Changed May 23, 2011 04:29AM UTC by timmywil comment:7


Changed May 24, 2011 09:35PM UTC by dmethvin comment:8

+1, Makes the semantics more predictable too.

Changed June 03, 2011 01:54PM UTC by john comment:9


Changed June 05, 2011 09:30PM UTC by ajpiano comment:10

+1, Anything we can do to improve the perf of $(element).data("yesplease!")

Changed July 12, 2011 02:45PM UTC by dmethvin comment:11

milestone: 1.next1.7
priority: undecidedblocker

Changed September 15, 2011 05:24PM UTC by gnarf comment:12

Updated the pull request in comment #1 - has some perf data

Changed September 19, 2011 08:15PM UTC by Corey Frang comment:13

resolution: → fixed
status: assignedclosed

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