Chrome is buggy here, the specs state that
If url is not given:
Set url to a new URL.
If input contains any leading or trailing C0 control or space, validation error.
So this should be a validation error.
Unfortunately I don't know any other way to do the same (using an anchor exposes the same bug), maybe you could browserify node's implementation, but I didn't try myself.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…