swisnl / jQuery-contextMenu

jQuery contextMenu plugin & polyfill

Home Page:https://swisnl.github.io/jQuery-contextMenu/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Word breaking…

rodneyrehm opened this issue · comments

This has been reported via mail by Lynne:

fiddle to play with

Left: Firefox 16 Mac, Right: IE9 Win7

Firefox Mac left, IE9 right

Left: Firefox 16 Mac, Right: Firefox 16 Win7

Firefox Mac left, Firefox Win right

proposed solution was

/*  around line 1090 */

// determine widths of submenus, as CSS won't grow them automatically
// position:absolute > position:absolute; min-width:100; max-width:200; results in width: 100;
// kinda sucks hard...
opt.$menu.find('ul').andSelf().css({position: 'static', display: 'block'}).each(function(){
    var $this = $(this);
    $this.width($this.css('position', 'absolute').width() + 1)
        .css('position', 'static');

(adding a single pixel to the width returned) the wrap problem disappeared. I am not sure why the problem occurs but have read that IE9 may calculate widths to sub pixel resolution and perhaps width() is rounding? I have found that adding the single pixel corrects the problem in IE 9 without seriously affecting the appearance in FF.