nl_tokens: Monitor the original element for changes and update select2 accordingly abstract
pl_tokens: function ( ) { var el = this . opts . element , sync ; el . on ( "change.select2" , this . bind ( function ( e ) { if ( this . opts . element . data ( "select2-change-triggered" ) !== true ) { this . initSelection ( ) ; } } ) ) ; sync = this . bind ( function ( ) { var enabled , readonly , self = this ; // sync enabled state var disabled = el . prop ( "disabled" ) ; if ( disabled === undefined ) disabled = false ; this . enable ( ! disabled ) ; var readonly = el . prop ( "readonly" ) ; if ( readonly === undefined ) readonly = false ; this . readonly ( readonly ) ; syncCssClasses ( this . <mask> , this . opts . element , this . opts . adaptContainerCssClass ) ; this . container . addClass ( evaluate ( this . opts . containerCssClass ) ) ; syncCssClasses ( this . dropdown , this . opts . element , this . opts . adaptDropdownCssClass ) ; this . dropdown . addClass ( evaluate ( this . opts . dropdownCssClass ) ) ; } ) ; // mozilla and IE el . on ( "propertychange.select2 DOMAttrModified.select2" , sync ) ; // hold onto a reference of the callback to work around a chromium bug if ( this . mutationCallback === undefined ) { this . mutationCallback = function ( mutations ) { mutations . forEach ( sync ) ; } } // safari and chrome if ( typeof WebKitMutationObserver !== "undefined" ) { if ( this . propertyObserver ) { delete this . propertyObserver ; this . propertyObserver = null ; } this . propertyObserver = new WebKitMutationObserver ( this . mutationCallback ) ; this . propertyObserver . observe ( el . get ( 0 ) , { attributes : true , subtree : false } ) ; } }