You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calling destroyAll keeps some state even though the word All implies that it's clean slate. For example it does not care about _shared.styleEl or _shared object contents at all which might cause problems.
Keeping global state between destroyAll and init might cause a problem where SPA type application is used and head is modified in the DOM in a way that PullToRefresh styleEl is removed from it, which is used internally by PullToRefresh.
For example, I'm using a library called morphdom to patch head and body after fetch request and this also removes styleEl. It should not be a problem in itself because I'm also calling PullToRefresh.destroyAll() before patching and PullToRefresh.init() after patching the DOM.
However, since PullToRefresh setupDOM function only checks if _shared.styleEl has a value, but does not care about the styleEl being part of the DOM. It just assumes that it is part of the DOM.
Bug report
Calling
destroyAll
keeps some state even though the wordAll
implies that it's clean slate. For example it does not care about_shared.styleEl
or_shared
object contents at all which might cause problems.Fixes a problem reported previously in #108
Current behavior:
Keeping global state between
destroyAll
andinit
might cause a problem where SPA type application is used andhead
is modified in the DOM in a way that PullToRefreshstyleEl
is removed from it, which is used internally by PullToRefresh.For example, I'm using a library called morphdom to patch
head
andbody
afterfetch
request and this also removesstyleEl
. It should not be a problem in itself because I'm also callingPullToRefresh.destroyAll()
before patching andPullToRefresh.init()
after patching the DOM.However, since PullToRefresh
setupDOM
function only checks if_shared.styleEl
has a value, but does not care about thestyleEl
being part of the DOM. It just assumes that it is part of the DOM.A quick fix would be to change
setupDOM
to this:Basically we should check that
styleEl
is part of the DOM and if not then put it there.Expected behavior:
Should even work when PullToRefresh internally used element for styling is removed from DOM.
JSFiddle URL for demo with bug:
N/A
Browsers affected:
Every browser.
The text was updated successfully, but these errors were encountered: