Skip to content

Commit

Permalink
Adds escapeHTML to SC.MenuPane
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasbadia authored and dcporter committed Feb 14, 2014
1 parent 07abb34 commit 1eb463b
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions frameworks/desktop/panes/menu.js
Expand Up @@ -228,6 +228,14 @@ SC.MenuPane = SC.PickerPane.extend(
*/ */
isSubMenu: NO, isSubMenu: NO,


/**
If true, title of menu items will be escaped to avoid scripting attacks.
@type Boolean
@default YES
*/
escapeHTML: YES,

/** /**
Whether the title of menu items should be localized before display. Whether the title of menu items should be localized before display.
Expand Down Expand Up @@ -649,7 +657,7 @@ SC.MenuPane = SC.PickerPane.extend(
exampleViewKey, itemExampleView, exampleViewKey, itemExampleView,
height, heightKey, separatorKey, defaultHeight, separatorHeight, height, heightKey, separatorKey, defaultHeight, separatorHeight,
menuHeight, menuHeightPadding, keyEquivalentKey, keyEquivalent, menuHeight, menuHeightPadding, keyEquivalentKey, keyEquivalent,
keyArray, idx, layerIdKey, propertiesHash, keyArray, idx, layerIdKey, propertiesHash, escapeHTML,
len; len;


if (!items) return views; // return an empty array if (!items) return views; // return an empty array
Expand All @@ -661,6 +669,7 @@ SC.MenuPane = SC.PickerPane.extend(
keyEquivalentKey = this.get('itemKeyEquivalentKey'); keyEquivalentKey = this.get('itemKeyEquivalentKey');
separatorHeight = this.get('itemSeparatorHeight'); separatorHeight = this.get('itemSeparatorHeight');
layerIdKey = this.get('itemLayerIdKey'); layerIdKey = this.get('itemLayerIdKey');
escapeHTML = this.get('escapeHTML');
menuHeightPadding = Math.floor(this.get('menuHeightPadding') / 2); menuHeightPadding = Math.floor(this.get('menuHeightPadding') / 2);
menuHeight = menuHeightPadding; menuHeight = menuHeightPadding;


Expand Down Expand Up @@ -689,7 +698,8 @@ SC.MenuPane = SC.PickerPane.extend(
layout: { height: height, top: menuHeight }, layout: { height: height, top: menuHeight },
contentDisplayProperties: keyArray, contentDisplayProperties: keyArray,
content: item, content: item,
parentMenu: this parentMenu: this,
escapeHTML: escapeHTML
}; };


if (item.get(layerIdKey)) { if (item.get(layerIdKey)) {
Expand Down

0 comments on commit 1eb463b

Please sign in to comment.