Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[colorwidget] Do not set element colour if it has not changed

  • Loading branch information...
commit 1a55ddcc6bd647356974d619ea81b451f10e99d8 1 parent 157b82d
@gabrielschulhof gabrielschulhof authored
Showing with 10 additions and 8 deletions.
  1. +10 −8 src/widgets/010_colorwidget/js/colorwidget.js
View
18 src/widgets/010_colorwidget/js/colorwidget.js
@@ -43,17 +43,19 @@ $.widget("todons.colorwidget", $.todons.widgetex, {
},
_setElementColor: function(el, hsl, cssProp) {
- var clrlib = $.todons.colorwidget.clrlib,
+ var old = el.jqmData("hsl") || [-1, -1, -1];
+ if (!(old[0] === hsl[0] && old[1] === hsl[1] && old[2] === hsl[2])) {
+ var clrlib = $.todons.colorwidget.clrlib,
clr = clrlib.RGBToHTML(clrlib.HSLToRGB(hsl)),
dclr = clrlib.RGBToHTML(clrlib.HSLToGray(hsl));
- el.jqmData("clr", clr);
- el.jqmData("dclr", dclr);
- el.jqmData("cssProp", cssProp);
- el.attr("data-" + ($.mobile.ns || "") + "has-dclr", true);
- el.css(cssProp, this.options.disabled ? dclr : clr);
-
- return { clr: clr, dclr: dclr };
+ el.jqmData("hsl", hsl);
+ el.jqmData("clr", clr);
+ el.jqmData("dclr", dclr);
+ el.jqmData("cssProp", cssProp);
+ el.attr("data-" + ($.mobile.ns || "") + "has-dclr", true);
+ el.css(cssProp, this.options.disabled ? dclr : clr);
+ }
},
_displayDisabledState: function(toplevel) {
Please sign in to comment.
Something went wrong with that request. Please try again.