Fix for RF-13706: dequeued Ajax request not processed correctly if its source element has been updated

The goal is to remove stale requests from the head of the queue, until the queue is empty or a valid request has been found. I define a request as stale, if it originated from an element that is not in the document any more, or that has been "cut-off" from the parent form because one of its ancestors in the DOM tree has been replaced.