Added ability to specify the element that gets style in a view

when no jquery selector is provided (default).
This commit is contained in:
Jonathan Frederic 2013-10-30 23:07:48 +00:00
parent c95fbfad28
commit 19f0372f54

View File

@ -316,10 +316,16 @@ define(["components/underscore/underscore-min",
if (this.model.css.hasOwnProperty(selector)) { if (this.model.css.hasOwnProperty(selector)) {
// Get the elements via the css selector. If the selector is // Get the elements via the css selector. If the selector is
// blank, assume the current element is the target. // blank, apply the style to the $el_to_style element. If
// the $el_to_style element is not defined, use apply the
// style to the view's element.
var elements = this.$el.find(selector); var elements = this.$el.find(selector);
if (selector=='') { if (selector=='') {
elements = this.$el; if (this.$el_to_style == undefined) {
elements = this.$el;
} else {
elements = this.$el_to_style;
}
} }
// Apply the css traits to all elements that match the selector. // Apply the css traits to all elements that match the selector.