Hiding the Browse by Category Section
This is what I put in for them
$('h4:contains("Browse By Category")').parent().hide()But alas, it works fine in all browsers, and on server versions of IE but not IE 11 on a Windows 10 client. When clicking on a link which takes the user to the service offering, the entire portal fails to load
Any ideas why this tiny piece of code would cause this? It also only happens intermittently just to add further confusion
Answers
Do you have any mutation observers, or do you use setInterval to control when this statement occurs? I obviously have no idea, but it seems as though there might be an error with one of those or the lack thereof might be causing your statement to run before the page is fully laid out.
You may have already thought of this, but if not I hope it helps.
This is the current script with the hiding commented out due to the above issue. It's being called with loadscript function on ServiceCatalog/Listing
I unfortunately don't have time to drop this in and test it, but I suspect that wrapping your "hide" code in some kind of test to ensure that it only runs once may be the way to fix this. Given that you are testing for the presence of a completely different element below, you could use a second observer (so that it can be disconnected on its own terms). I thought briefly of modifying your IF or just adding a second one, but that might cause more of a visual delay, potentially (since both elements would need to be present. It would solve the problem of running more than once, though.
Without actual testing, these are just thoughts, of course, but I hope they help.
As a further test I did have it outside of a mutation observer (document.ready) and it did the same thing.
It's the whole only client IE which is throwing me!
The solution to this is obviously to purge IE from the environment with extreme prejudice and ban its use going forward, but I doubt that is an option since you haven't already done it.
Technically JQuery is taking care of the test to see if the element exists for you, so you could use that to your advantage. If you haven't already tried this (not sure from your reply), you could try something like this in document.ready():
This all assumes that the issue has something to do with timing and trying to handle this within the other mutation observer. You could replace this with another mutation observer to accomplish the same thing instead of setInterval, of course. If timing and/or running this code too often inside the other observer is not the issue, then this will only serve to rule it out.
If that is the case, then I wonder if something else unrelated is running that is interfering (perhaps erroring out, stopping script execution?). IE is absolutely terrible for debugging compared to its peers, so it would not be difficult to miss this (another reason to eradicate it!).
As it happens (it would appear that the customer didn't want to do any significant debugging on their IE to work out why this is occurring) the hiding of the content browser has been removed from their requirements but I'm going to have a bit more of a play with the above when I've got some further time to see why this issue arises.