Interesting difference but why is querySelector(`#${CSS.escape(id)}`) better?
I would prefer to use valid id's but also, when selecting by id I just use getElementByID?
You could also use querySelectorAll(id) and have more than one element with the same id. It doesn't seem like a good idea.