This is what Blink and Gecko do, and is required for serialization (innerHTML etc.) of XML elements to work. (cherry picked from commit cad3b085a89b6a7f1e06f8e5d039959e7f26faa2)