From 92db1d5dfc4fc2c162f88bb0442076fd8e561735 Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Sat, 8 Feb 2014 16:36:38 +0100 Subject: [PATCH] DOM elements were cached after remove()'d --- js/contacts.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/js/contacts.js b/js/contacts.js index ea667672..9265d7ce 100644 --- a/js/contacts.js +++ b/js/contacts.js @@ -1621,19 +1621,17 @@ OC.Contacts = OC.Contacts || {}; src; var $phototools = this.$fullelem.find('#phototools'); - if(!this.$photowrapper) { - this.$photowrapper = this.$fullelem.find('#photowrapper'); - } + var $photowrapper = this.$fullelem.find('#photowrapper'); var finishLoad = function(image) { console.log('finishLoad', self.getDisplayName(), image.width, image.height); $(image).addClass('contactphoto'); - self.$photowrapper.removeClass('loading wait'); - self.$photowrapper.css({width: image.width + 10, height: image.height + 10}); + $photowrapper.removeClass('loading wait'); + $photowrapper.css({width: image.width + 10, height: image.height + 10}); $(image).insertAfter($phototools).fadeIn(); }; - this.$photowrapper.addClass('loading').addClass('wait'); + $photowrapper.addClass('loading').addClass('wait'); console.log('hasPhoto', this.hasPhoto()); if(!this.hasPhoto()) { $.when(this.storage.getDefaultPhoto()) @@ -1659,7 +1657,7 @@ OC.Contacts = OC.Contacts || {}; } if(this.isEditable()) { - this.$photowrapper.on('mouseenter', function(event) { + $photowrapper.on('mouseenter', function(event) { if($(event.target).is('.favorite') || !self.data) { return; }