jarek-foksa / xel

Xel - Widget toolkit for building native-like Electron and Web apps
https://xel-toolkit.org
Other
679 stars 58 forks source link

x-colorselect onChange event not reporting new color value #78

Closed mmakrzem closed 5 years ago

mmakrzem commented 5 years ago

I created a x-colorselect element using the following code:

const colorEl = document.createElement( 'x-colorselect' );

colorEl.addEventListener( 'change', ( ev : Event ) => {
      if( ev.srcElement !== null ) {
        console.log( 'src ', ev.srcElement.value );
      }
      if( ev.target !== null ) {
        console.log( 'target ', ev.target.value );
      }
    }  );

When I change the color value (say from white to red), the onChangeEvent fires, but I don't seem to have a way to retrieve the newly selected red color. Both of the console log messages display the "old" color value (white). If I change the color value from red to green, the onChangeEvent fires and now I see red. So the changed color value output is delayed.

jarek-foksa commented 5 years ago

This should be fixed in version 0.0.152, please reopen the issue if you can still reproduce it.

mmakrzem commented 5 years ago

Thanks, it works now. Also, as a FYI I noticed that in https://github.com/jarek-foksa/xel/blob/master/utils/color.js on line 956, you are missing a declaration of the variable named 'text'. Line 956 should be:

let text = char + scanner.read(3);

jarek-foksa commented 5 years ago

Thanks, I have fixed that typo in version 0.0.153.