Modify ↓
Ticket #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: | ||
| Blocking: | Blocked by: |
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
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
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.