Though I have changed this, it's not really related to your use case -- it's simply unnecessary in the default case (and thus outputs extra text).
Your selector would have also depended on the install not being in a particular directory (and route filters not being in use). Not to mention, while I understand why you were trying to do this, the exact value of a link isn't an unchangeable thing.