Ensure href is not set to "" when target is null (#10543)

A link with href="" causes a reload of the page, at least in Firefox.

Change-Id: I0d04615b3669d3b7ccab5bf0d45b6a665f32fb1e