setD3SelAttrsPreservingClasses: Check that classList is not undefined, which it sometimes is on Safari, can cause an exception.