Menu: parse HTML entities for title property of events

This commit is contained in:
rlx 2012-08-13 13:20:07 +00:00
parent ff1e6d4833
commit 0de55efb96
2 changed files with 10 additions and 7 deletions

View file

@ -1204,7 +1204,6 @@ Ox.List = function(options, self) {
// fixme: callback is never used
// note: can't use selectNone here,
// since it'd trigger a select event
Ox.Log('List', 'SET SELECTED', ids)
var counter = 0;
self.$items.forEach(function($item, pos) {
if (isSelected(pos)) {

View file

@ -137,7 +137,7 @@ Ox.Menu = function(options, self) {
if (self.options.parent) {
self.options.parent.hideMenu(true).triggerEvent('click', Ox.extend({
id: item.options('id'),
title: Ox.stripTags(item.options('title')[0])
title: parseTitle(item.options('title')[0])
}, files ? {files: files} : {}));
}
if (item.options('checked') !== null) {
@ -154,7 +154,7 @@ Ox.Menu = function(options, self) {
return {
id: that.items[pos + offset].options('id'),
title: Ox.isString(that.items[pos + offset].options('title')[0])
? Ox.stripTags(that.items[pos + offset].options('title')[0]) : ''
? parseTitle(that.items[pos + offset].options('title')[0]) : ''
};
})
});
@ -165,7 +165,7 @@ Ox.Menu = function(options, self) {
checked: item.options('checked'),
id: item.options('id'),
title: Ox.isString(item.options('title')[0])
? Ox.stripTags(item.options('title')[0]) : ''
? parseTitle(item.options('title')[0]) : ''
});
}
} else {
@ -174,7 +174,7 @@ Ox.Menu = function(options, self) {
if (!item.options('file') || files) {
menu.triggerEvent('click', Ox.extend({
id: item.options('id'),
title: Ox.stripTags(item.options('title')[0])
title: parseTitle(item.options('title')[0])
}, files ? {files: files} : {}));
}
}
@ -290,6 +290,10 @@ Ox.Menu = function(options, self) {
}
}
function parseTitle(title) {
return Ox.decodeHTMLEntities(Ox.stripTags(title));
}
function renderItems(items) {
var offset = 0;
@ -472,7 +476,7 @@ Ox.Menu = function(options, self) {
/* disabled
that.triggerEvent('deselect', {
id: item.options('id'),
title: Ox.stripTags(item.options('title')[0])
title: Ox.parseTitle(item.options('title')[0])
});
*/
}
@ -493,7 +497,7 @@ Ox.Menu = function(options, self) {
that.triggerEvent('select', {
id: item.options('id'),
title: Ox.isString(item.options('title')[0])
? Ox.stripTags(item.options('title')[0]) : ''
? parseTitle(item.options('title')[0]) : ''
});
}
self.options.selected = position;