sindresorhus / element-ready

Detect when an element is ready in the DOM
MIT License
436 stars 15 forks source link

Found elements are not uncached #12

Closed fregante closed 6 years ago

fregante commented 6 years ago
add element
wait for element
resolve promise

add element (different, but same selector)
wait for element
resolve promise (resolves with first element)

I'm adding a test

sindresorhus commented 6 years ago

Is the first element removed in this scenario, before the second call to elementReady? Otherwise, I would say it's the correct behavior, as it always finds the first element that matches, even though it has matched before. Or am I misunderstanding?

fregante commented 6 years ago

The element is gone from the page but it’s still cached, so the new element is not found at all

fregante commented 6 years ago

However the test I added seems to succeed, so the issue may be slightly different.

My expectation is: once found, the cache should be empty. If you try RGH, you’ll find a cached selector for document long after it was found.

sindresorhus commented 6 years ago

The element is gone from the page but it’s still cached

But that's not reflected in your test https://github.com/sindresorhus/element-ready/pull/13

fregante commented 6 years ago

But that's not reflected in your test #13

Yeah :P

However the test I added seems to succeed

I have to look into RGH further