pass object in to attr functions.
This commit is contained in:
parent
0aafeb2530
commit
db365a2228
|
@ -2601,9 +2601,11 @@ List.prototype.add = function(item) {
|
||||||
// TODO: Move all specific options to their own object namespaces.
|
// TODO: Move all specific options to their own object namespaces.
|
||||||
var sname = 'selected' + name[0].toUpperCase() + name.substring(1);
|
var sname = 'selected' + name[0].toUpperCase() + name.substring(1);
|
||||||
options[name] = function() {
|
options[name] = function() {
|
||||||
return self.items[self.selected] === item
|
var attr = self.items[self.selected] === item
|
||||||
? self[sname]
|
? self[sname]
|
||||||
: self[name];
|
: self[name];
|
||||||
|
if (typeof attr === 'function') attr = attr(item);
|
||||||
|
return attr;
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -4233,14 +4235,14 @@ function sattr(obj, fg, bg) {
|
||||||
|
|
||||||
// This used to be a loop, but I decided
|
// This used to be a loop, but I decided
|
||||||
// to unroll it for performance's sake.
|
// to unroll it for performance's sake.
|
||||||
if (typeof bold === 'function') bold = bold();
|
if (typeof bold === 'function') bold = bold(obj);
|
||||||
if (typeof underline === 'function') underline = underline();
|
if (typeof underline === 'function') underline = underline(obj);
|
||||||
if (typeof blink === 'function') blink = blink();
|
if (typeof blink === 'function') blink = blink(obj);
|
||||||
if (typeof inverse === 'function') inverse = inverse();
|
if (typeof inverse === 'function') inverse = inverse(obj);
|
||||||
if (typeof invisible === 'function') invisible = invisible();
|
if (typeof invisible === 'function') invisible = invisible(obj);
|
||||||
|
|
||||||
if (typeof fg === 'function') fg = fg();
|
if (typeof fg === 'function') fg = fg(obj);
|
||||||
if (typeof bg === 'function') bg = bg();
|
if (typeof bg === 'function') bg = bg(obj);
|
||||||
|
|
||||||
return ((((invisible ? 16 : 0) << 18)
|
return ((((invisible ? 16 : 0) << 18)
|
||||||
| ((inverse ? 8 : 0) << 18)
|
| ((inverse ? 8 : 0) << 18)
|
||||||
|
|
Loading…
Reference in New Issue