dart-archive / polymer-dart

Polymer support for Dart
https://pub.dartlang.org/packages/polymer
BSD 3-Clause "New" or "Revised" License
181 stars 33 forks source link

Observer with 3 arguments gives wrong result in the release build. #699

Closed slodko closed 8 years ago

slodko commented 8 years ago

Description

Observer with 3 arguments gives wrong result in the release build (but not in debug).

Steps to Reproduce

  1. Create hsl-progress element:
@PolymerRegister('hsl-progress')
class HslProgress extends PolymerElement {
    @property
    num h;
    @property
    num s;
    @property
    num l;
    @property
    num value;

    HslProgress.created() : super.created();

    @Observe('h, s, l')
    updateColor(hh, ss, ll){
        ($['progress'] as PaperProgress)
                .customStyle["--paper-progress-active-color"] = "hsl($hh,$ss%,$ll%)";
        updateStyles();
    }
}
<dom-module id="hsl-progress">
    <template>
        <paper-progress id="progress" value="[[value]]"></paper-progress>
    </template>
</dom-module>
  1. Append ie. <hsl-progress h="10" s="90" l="50" value="60"></hsl-progress> to document.body (red color).
  2. Make pub build --mode=release

    Expected Results

The active color of the paper progress should have "hsl(h,s,l)" colour.

Actual Results

The active color of the paper progress have "hsl(h,s,h)" colour.

jakemac53 commented 8 years ago

I was not able to repro this issue, so I am guessing there is some other issue going on in your case. One thing I did notice though is you need to call updateStyles() on the progress element, not this. In other words:

@Observe('h, s, l')
updateColor(hh, ss, ll){
    var progressBar = $['progress'] as PaperProgress;
    progressBar.customStyle["--paper-progress-active-color"] = "hsl($hh,$ss%,$ll%)";
    progressBar.updateStyles();
}
slodko commented 8 years ago

Ok, I found out that the issue might be difficult to reproduce because it depends on the name of the property (everything works as expected when I change @property num l to ie. @property num a).

zoechi commented 8 years ago

Wasn't there some issue with such short (one character) property names in dart2js or dart-js-interop recently? What Dart and Polymer version are you using?

jakemac53 commented 8 years ago

Ya, I do seem to remember something about certain one character names having issues (although these ones worked fine for me), cc @rakudrama

slodko commented 8 years ago

I use dart sdk: 1.16.0, polymer: 1.0.0-rc.17, polymer_interop: 1.0.0-rc.9.

refi64 commented 8 years ago

668 was the one.