Skip to content
This repository has been archived by the owner on Jul 3, 2023. It is now read-only.

Using Element.addClass() using aspect function has unpredictable behavior #124

Closed
SonnyX opened this issue Jun 9, 2019 · 5 comments
Closed

Comments

@SonnyX
Copy link

SonnyX commented Jun 9, 2019

function bool_setting() {
  stdout.println("Attached!");
  this.attributes.addClass("true");
}

Usingaspect: "bool_setting"; in the css of a button makes the button (and surrounding elements) dissapear whereas clicking the button in the following scenario does not:

function bool_setting() {
  this << event click (evt) {
    stdout.println("Clicked button");
    this.attributes.addClass("true");
  }
}

Sciter version: 4.3.0.6

@SonnyX SonnyX changed the title Adding class using aspect function has unpredictable behavior Using Element.addClass() using aspect function has unpredictable behavior Jun 9, 2019
@c-smile
Copy link
Owner

c-smile commented Jun 9, 2019

I do not see any problems with this:

<html>
    <head>
        <title>Test</title>
        <style>
           button {
             aspect: bool_setting;
           }

           button.true {
            color: red;
           }

        </style>
        <script type="text/tiscript">

        function bool_setting() {
          this.attributes.addClass("true");
        }

        </script>
    </head>
    <body>
      <button>Test</button>
    </body>
</html>

@SonnyX
Copy link
Author

SonnyX commented Jun 9, 2019

https://github.com/SonnyX/RenegadeX-Windows-Launcher/releases/download/0.0/specific.zip

Made a little showcase for you where this bug occurs.
Just usciter the frontpage.htm and click news.
in frontpage.htm the function bool_setting() exists

@c-smile
Copy link
Owner

c-smile commented Jun 9, 2019

I am able to reproduce the issue. thanks. Looking.

For a while replace this.attributes.addClass("true"); by this.post(::this.attributes.addClass("true"));

Problem is that aspect execution happens at the momemt of style assignment and your code is changing the class of element at the same time.

@SonnyX
Copy link
Author

SonnyX commented Jun 9, 2019

Cool thanks,
I figured it was something like that. Thanks for the (temp) solution though!

@SonnyX
Copy link
Author

SonnyX commented Aug 2, 2019

Fixed as of 4.3.0.7, as stated in logfile.htm

@SonnyX SonnyX closed this as completed Aug 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants