jquery.maphilight.js – патч для IE8

Забавный плагин для подсветки AREA элементов в MAP – jquery.maphilight.js (http://plugins.jquery.com/project/maphilight). Как работает – лучше посмотреть официальную документацию. Все бы ничего, но последний апдейт датирован весной 2008 года, когда IE 8 еще не было. Соответственно в нем он и не работает:

Недопустимый аргумент.  jquery.maphilight.min.js, строка 1 символ 1166

(в несжатом файле jquery.maphilight.min.js, строка 63). Как оказалось, это дело поправимое. Строки 63 и 64 выглядят так:

document.createStyleSheet().addRule("v\:*", "behavior: url(#default#VML); antialias: true;"); //IE8 chokes on this line.
document.namespaces.add("v", "urn:schemas-microsoft-com:vml");

Их нужно заменить на:

document.namespaces.add("v", "urn:schemas-microsoft-com:vml");
var style = document.createStyleSheet();var shapes = ['shape','rect', 'oval', 'circ', 'fill', 'stroke', 'imagedata', 'group','textbox']; 
$.each(shapes,    function()
    {        style.addRule('v\:' + this, "behavior: url(#default#VML); antialias:true");
    }
);

Это работает ;)
Оригинал решения найден тут: http://stackoverflow.com/questions/1169162/any-alternatives-for-the-jquery-hilight-plugin

По мотивам бага создан запрос разработчику. Будет ли исправлен неизвестно, но найти его можно тут: http://plugins.jquery.com/node/10552

This entry was posted in Профессиональное and tagged , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">