How to determine if the selector portion of a load() call failed
I'm trying to use load() with a url and a selector, like so:
myObject.load('url.html #selector', function(response,status, xhr) {
// code here
})
I can test for the ajax request to fail, but browsing the source code of jQuery shows that if the selector fails, the entire content of the url.html document is loaded into myObject. In my use case, the browsers just reject inserting the full document and I'm left with no content.
After discussing this with a guru here, I can see why this would be the fallback method chosen, but it seems inelegant. Is is possible to test for failure of the selector portion of the parameter? If so, are there any plans to give a method for testing if the selector portion of a load() call fails in a future release?