Skip to content

Commit 761ceee

Browse files
committed
Fix setEntry(title) for titles containing icons
Close mar10#109
1 parent 12f318e commit 761ceee

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# 1.13.0-0 / Unreleased
2-
*
1+
# 1.13.1-0 / Unreleased
2+
* [BUGFIX] #109 Fix `setEntry(title)` for titles containing icons
33

44
# 1.13.0 / 2016-08-21
55

jquery.ui-contextmenu.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -476,13 +476,14 @@ $.extend($.moogle.contextmenu, {
476476
return item.has(">div[aria-haspopup='true']").length > 0;
477477
}
478478
},
479-
/** Replaces the value of elem's first text node child */
480-
replaceFirstTextNodeChild: function(elem, text) {
479+
/** Replace the title of elem', but retain icons andchild entries. */
480+
replaceFirstTextNodeChild: function(elem, html) {
481+
var $icons = elem.find(">span.ui-icon,>ul.ui-menu").detach();
482+
481483
elem
482-
.contents()
483-
.filter(function() { return this.nodeType === 3; })
484-
.first()
485-
.replaceWith(text);
484+
.empty()
485+
.html(html)
486+
.append($icons);
486487
},
487488
/** Updates the menu item's title */
488489
updateTitle: function(item, title) {

0 commit comments

Comments
 (0)