|
21 | 21 | // determine html5 compatibility
|
22 | 22 | $.support.htmlMenuitem = ('HTMLMenuItemElement' in window);
|
23 | 23 | $.support.htmlCommand = ('HTMLCommandElement' in window);
|
| 24 | +$.support.eventSelectstart = ("onselectstart" in document.documentElement); |
| 25 | +/* // should the need arise, test for css user-select |
| 26 | +$.support.cssUserSelect = (function(){ |
| 27 | + var t = false, |
| 28 | + e = document.createElement('div'); |
| 29 | + |
| 30 | + $.each('Moz|Webkit|Khtml|O|ms|Icab|'.split('|'), function(i, prefix) { |
| 31 | + var propCC = prefix + (prefix ? 'U' : 'u') + 'serSelect', |
| 32 | + prop = (prefix ? ('-' + prefix.toLowerCase() + '-') : '') + 'user-select'; |
| 33 | + |
| 34 | + e.style.cssText = prop + ': text;'; |
| 35 | + if (e.style[propCC] == 'text') { |
| 36 | + t = true; |
| 37 | + return false; |
| 38 | + } |
| 39 | + |
| 40 | + return true; |
| 41 | + }); |
| 42 | + |
| 43 | + return t; |
| 44 | +})(); |
| 45 | +*/ |
24 | 46 |
|
25 | 47 | var // currently active contextMenu trigger
|
26 | 48 | $currentTrigger = null,
|
@@ -1048,12 +1070,11 @@ var // currently active contextMenu trigger
|
1048 | 1070 | $t.appendTo(opt.$menu);
|
1049 | 1071 |
|
1050 | 1072 | // Disable text selection
|
1051 |
| - if (!opt.hasTypes) { |
1052 |
| - if($.browser.msie) { |
1053 |
| - $t.on('selectstart.disableTextSelect', handle.abortevent); |
1054 |
| - } else if(!$.browser.mozilla) { |
1055 |
| - $t.on('mousedown.disableTextSelect', handle.abortevent); |
1056 |
| - } |
| 1073 | + if (!opt.hasTypes && $.support.eventSelectstart) { |
| 1074 | + // browsers support user-select: none, |
| 1075 | + // IE has a special event for text-selection |
| 1076 | + // browsers supporting neither will not be preventing text-selection |
| 1077 | + $t.on('selectstart.disableTextSelect', handle.abortevent); |
1057 | 1078 | }
|
1058 | 1079 | });
|
1059 | 1080 | // attach contextMenu to <body> (to bypass any possible overflow:hidden issues on parents of the trigger element)
|
|
0 commit comments