Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setPolling(false) cannot turn off polling #2432

Closed
nbdd0121 opened this issue Apr 1, 2015 · 3 comments
Closed

setPolling(false) cannot turn off polling #2432

nbdd0121 opened this issue Apr 1, 2015 · 3 comments

Comments

@nbdd0121
Copy link

nbdd0121 commented Apr 1, 2015

Perhaps the code mean

 if (this.$pollSizeChangesTimer) {
    clearInterval(this.$pollSizeChangesTimer);
    this.$pollSizeChangesTimer = 0;
}

instead of

 if (this.$pollSizeChangesTimer)
    this.$pollSizeChangesTimer;

Since the latter one makes no sense at all.

What's more, probably we can use MutationObserver to replace the polling if supported

@nightwing
Copy link
Member

Thanks for the bug report, i've added suggested fix to #2459.

What's more, probably we can use MutationObserver to replace the polling if supported

Does MutationObserver allow to detect when size of element is changed due to zoom or font style change? AFAIK it should be only for attribute or children modifications.

@nbdd0121
Copy link
Author

Does MutationObserver allow to detect when size of element is changed due to zoom or font style change? AFAIK it should be only for attribute or children modifications.

MutationObserver can be used to detect inline style change, ex. the style attribute or setting of style via JavaScript. However style sheet changes and zoom will not be detected. So you are right, we shouldn't use it.

@felicienfrancois
Copy link
Contributor

CSS Element queries uses a event based approach for size change detection

new ResizeSensor(jQuery('#myElement'), function() {
    console.log('myelement has been resized');
});

It uses a invisible new element as an overlay on the desired target and utilize the "scroll" event on the overlay to trigger changes

Could be a solution ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants