Changes between Version 1 and Version 2 of Ticket #10050, comment 4


Ignore:
Timestamp:
May 23, 2014, 11:17:03 AM (8 years ago)
Author:
scott.k.mitch1
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #10050, comment 4

    v1 v2  
    33A few general things to look out for are:
    44* Clean up any jquery data cache you may be using. It is good practice to accompany any calls to {{{.data('x',y)}}} with a {{{.removeData('x')}}}
    5 * In general avoid using references to DOM elements in anonymous functions which are defined outside the scope of that anonymous function. Re-select unless you are sure the anonymous function will be made eligible for GC.  For example if the anonymous function is used to register for an {{{.on('click', ...)}}} then you want to make sure you do an {{{.off('click', ...)}}}
     5* In general avoid using references to DOM elements in anonymous functions which are defined outside the scope of that anonymous function. Re-select unless you are sure the anonymous function will be made eligible for GC.  For example if the anonymous function is used to register for an {{{.on('click', ...)}}} then you want to make sure you do an {{{.off('click', ...)}}} or equivalent call to un-register the event so there is no longer a reference to the anonymous function
    66* Avoid storing references to DOM elements in the {{{data}}} cache, or if you must make sure that you clean up after yourself. (inspect line 539 {{{return this._renderItem( ul, item ).data( "ui-autocomplete-item", item );}}})