Make sure getElementById always returns the first element with the given ID in tree order.(fixes #1822)
auto merge of #1917 : lpy/servo/issue1822, r=jdm

see #1822