newsdev / ai2html

A script for Adobe Illustrator that converts your Illustrator artwork into an html page.
http://ai2html.org
Other
898 stars 146 forks source link

Clickable link resizer fails in Safari #36

Closed dannydb closed 7 years ago

dannydb commented 8 years ago

Safari executes the else statement in this block of the resizer script for a clickable link promo because the parent node is an anchor tag with the default display of inline and width reports as 0:

if (+minwidth <= width && (+maxwidth >= width || maxwidth === null)) {
    var img = el.querySelector('.g-aiImg');
    if (img.getAttribute('data-src') && img.getAttribute('src') != img.getAttribute('data-src')) {
        img.setAttribute('src', img.getAttribute('data-src'));
    }
    el.style.display = "block";
} else {
    el.style.display = "none";
}

Explicitly setting display: block for .g-ai2htmlLink fixes the issue.