Swedish fashion retailer H&M has appointed a diversity leader in response to accusations of racism, after an image of a black child modelling a hoodie reading "coolest monkey in the jungle" appeared on its website.