2 var Marionette = require('backbone.marionette');
3 var highlight = require('../../utils/highlight');
4 var behaviourLookup = require('./lookup');
6 module.exports = (function() {
7 var Behavior = Marionette.Behavior.extend({
9 'change:highlights': 'onRender'
12 onRender: function() {
13 if (!this.view.model) return;
14 var highlights = this.view.model.get('highlights');
16 if (this.highlighted) {
17 highlight.removeHighlights(this.view.el);
20 if (!highlights || !highlights.length) return;
22 this.highlighted = true;
23 highlight.highlight(this.view.el, highlights);
27 behaviourLookup.register('Highlight', Behavior);