A regex pattern bug was messing with attribute values (like querystrings) where the letter either side of an equals was the same. Whilst this would not create invalid HTML, it would break hyperlinks and "IE=edge" for example.
Massive thanks to Bruno Heridet for narrowing down the fault and Zegnat for suggesting a fix.
Merged DOMTemplate fix from master.