Sometimes you have to use defensive programming and assume that people can and will deviate from specs. Do not assume that if X returns Y it supports Z. It’s annoying, but it will make you programs more resilient and able to support in your case more browsers. After all, there are many niche browsers out there with their own engines and quirks.