maphilight
maphilight copied to clipboard
Throws an error when used in XHTML context (using Firefox 37), stop working
When using maphilight with a page served with
application/xhtml+xml;
then Firefox will throw an exception at the line
a.innerHTML = '<v:shape id="vml_flag1" adj="1" />';
I've fixed this by extending the has_VML function using an exception.
Also changed b.adj == "object" to b.adj === "object" to shut up Netbeans from naging about the comparison. But this is not strictly needed to avoid Netscape throwing an error.
has_VML = (function() {
try {
var a = document.createElement('div');
a.innerHTML = '<v:shape id="vml_flag1" adj="1" />';
var b = a.firstChild;
b.style.behavior = "url(#default#VML)";
return b ? typeof b.adj === "object": true;
}
catch (err)
{
return false;
}
})();
Of course, once MSIE 9 is history, the VML part of this plugin could be dropped entirely.