Skip to content
This repository has been archived by the owner on Aug 14, 2021. It is now read-only.

Commit

Permalink
Fix setEntry(title) for titles containing icons
Browse files Browse the repository at this point in the history
Close #109
  • Loading branch information
mar10 committed Jan 27, 2017
1 parent 12f318e commit 761ceee
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# 1.13.0-0 / Unreleased
*
# 1.13.1-0 / Unreleased
* [BUGFIX] #109 Fix `setEntry(title)` for titles containing icons

# 1.13.0 / 2016-08-21

Expand Down
13 changes: 7 additions & 6 deletions jquery.ui-contextmenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -476,13 +476,14 @@ $.extend($.moogle.contextmenu, {
return item.has(">div[aria-haspopup='true']").length > 0;
}
},
/** Replaces the value of elem's first text node child */
replaceFirstTextNodeChild: function(elem, text) {
/** Replace the title of elem', but retain icons andchild entries. */
replaceFirstTextNodeChild: function(elem, html) {
var $icons = elem.find(">span.ui-icon,>ul.ui-menu").detach();

elem
.contents()
.filter(function() { return this.nodeType === 3; })
.first()
.replaceWith(text);
.empty()
.html(html)
.append($icons);
},
/** Updates the menu item's title */
updateTitle: function(item, title) {
Expand Down

0 comments on commit 761ceee

Please sign in to comment.