File tree 2 files changed +31
-1
lines changed
2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,28 @@ var items = {
59
59
```
60
60
61
61
62
+ ### isHtmlName
63
+
64
+ When truthy, the defined ` name ` value is HTML.
65
+
66
+ The value will be rendered using ` $.html() ` instead of ` $.text() ` .
67
+
68
+ __ Note: Cannot be used with the [ accesskey] ( #accesskey ) option in the same item.__
69
+
70
+ ` isHtmlName ` : ` boolean `
71
+
72
+ #### Example
73
+
74
+ ``` javascript
75
+ var items = {
76
+ firstCommand: {
77
+ name: " Copy <span style='font-weight: bold'>Text</span>︎" ,
78
+ isHtmlName: true
79
+ }
80
+ }
81
+ ```
82
+
83
+
62
84
### callback
63
85
64
86
Specifies the callback to execute if clicked on
Original file line number Diff line number Diff line change 1087
1087
$name . append ( document . createTextNode ( item . _afterAccesskey ) ) ;
1088
1088
}
1089
1089
} else {
1090
- $name . text ( item . name ) ;
1090
+ if ( item . isHtmlName ) {
1091
+ // restrict use with access keys
1092
+ if ( typeof item . accesskey !== 'undefined' ) {
1093
+ throw new Error ( 'accesskeys are not compatible with HTML names and cannot be used together in the same item' ) ;
1094
+ }
1095
+ $name . html ( item . name ) ;
1096
+ } else {
1097
+ $name . text ( item . name ) ;
1098
+ }
1091
1099
}
1092
1100
return $name ;
1093
1101
}
You can’t perform that action at this time.
0 commit comments