mirror of https://github.com/ElemeFE/element
removeResizeListener should ignore the function which is non-existen in the element.__resizeListeners_
If the function does not exist in the element.__resizeListeners__, This operation element.__resizeListeners__.indexOf(fn) yields a negative one. And then, element.__resizeListeners__.splice(-1, 1) cause the existing functions to be deleted;pull/21053/head
parent
3807b54ab2
commit
02f08af627
|
@ -28,6 +28,7 @@ export const addResizeListener = function(element, fn) {
|
|||
/* istanbul ignore next */
|
||||
export const removeResizeListener = function(element, fn) {
|
||||
if (!element || !element.__resizeListeners__) return;
|
||||
if (element.__resizeListeners__.indexOf(fn) === -1) return;
|
||||
element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1);
|
||||
if (!element.__resizeListeners__.length) {
|
||||
element.__ro__.disconnect();
|
||||
|
|
Loading…
Reference in New Issue