MCPcopy
hub / github.com/helloxz/onenav / createNameNode

Function createNameNode

static/jQuery-contextMenu/jquery.contextMenu.js:1141–1166  ·  view source on GitHub ↗
(item)

Source from the content-addressed store, hash-verified

1139 }
1140
1141 function createNameNode(item) {
1142 var $name = $('<span></span>');
1143 if (item._accesskey) {
1144 if (item._beforeAccesskey) {
1145 $name.append(document.createTextNode(item._beforeAccesskey));
1146 }
1147 $('<span></span>')
1148 .addClass('context-menu-accesskey')
1149 .text(item._accesskey)
1150 .appendTo($name);
1151 if (item._afterAccesskey) {
1152 $name.append(document.createTextNode(item._afterAccesskey));
1153 }
1154 } else {
1155 if (item.isHtmlName) {
1156 // restrict use with access keys
1157 if (typeof item.accesskey !== 'undefined') {
1158 throw new Error('accesskeys are not compatible with HTML names and cannot be used together in the same item');
1159 }
1160 $name.html(item.name);
1161 } else {
1162 $name.text(item.name);
1163 }
1164 }
1165 return $name;
1166 }
1167
1168 // create contextMenu items
1169 $.each(opt.items, function (key, item) {

Callers 1

Calls 4

$Function · 0.50
appendMethod · 0.45
textMethod · 0.45
htmlMethod · 0.45

Tested by

no test coverage detected