Background
I have a web application that currently runs on the Edge Internet Explorer mode. I want to port this application to modern browsers like Edge or Chrome.
The JavaScript in this application relys on IE7 doc mode (https://learn.microsoft.com/en-us/internet-explorer/ie11-deploy-guide/img-ie11-docmode-lg). For example, this application uses getElementById()
heavyly, and it assumes that getElementById()
performs a case-insensitive match on both the ID and NAME attributes.
Problem
Of course, you can rewrite this application based on the specs of getElementById()
in modern JavaScript API. But this application has so many JavaScript files, that it will require a fair amount of non-obvious work. So I am looking for some workarounds.
Question
Is there any way to emulate the behavior of getElementById()
of IE7 doc mode on modern browsers?
For example, how to reverse-polyfill the behavior of getElementById()
to imitate the behavior of it on IE7?
document.getElementById
with the legacy behaviour you want?document.getElementById
. Instead, use your own function. With modern tools (such as those Matt mentioned but also many others) you can readily change all occurrences ofdocument.getElementById
with your function's name.