Check for existence of String.prototype.trim before overwriting.