Opened 11 years ago
Closed 11 years ago
#11669 closed bug (worksforme)
Cache in jQuery.buildFragment has a bug
Reported by: | snandy | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.7.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
jQuery.buildFragment will cache the same fragment in jQuery.fragments.But the time is wrong.
For example:
var str = '<i>hi</i>'; var $body = $(document.body); $body.append(str); $body.append(str);
When the second call .append(str) should use the cache of jQuery.fragments. But at this time jQuery.fragments of '<i>hi</i>' is 1 but not fragment.
jQuery.fragments["<i>hi</i>"] = 1;
So, until the third call to build '<i>hi</i>' fragment began to use the cache. This is the wrong implementation.
Modify the following:
delete the code
cacheresults = jQuery.fragments[ first ]; if ( cacheresults && cacheresults !== 1 ) { fragment = cacheresults; }
use the following to replace
fragment = jQuery.fragments[ first ];
delete the code
jQuery.fragments[ first ] = cacheresults ? fragment : 1;
use the following to replace
jQuery.fragments[ first ] = fragment;
Change History (2)
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Closed per OP request.
Note: See
TracTickets for help on using
tickets.
Oh, I see. JQuery specially in the second to cache that was avoid memory takes too much. This is not a bug, Please closeed.