Here is the problem: we have a tag with 'onclick' attribute with value window.location.href='#/order/view':
Here is the generated code from BS:
your forum software is really strange, so I've uploaded screenshot here
Thank you for the report! Unfortunately I don't think this is a Bootstrap Studio bug. This is how single quotes are supposed to be escaped in HTML. It's not strictly needed to encode them in this case, but we do it to be safe. The onclick attribute does work when previewed in the browser.
I think the issue is with the VS Code linter, which doesn't take HTML encoded entities into account. The best workaround is to not write JS code in attributes; it's not considered a good practice anyway.
Hi, it does indeed work in some cases, unfortunately in other cases it just cause weird behavior and hard to find errors, so VS Code linter is absolutely right.
Example for such a case is using 'this':
converted by BStudio:
And it definitely not work! There are other problematic cases which I can't remember right now
At the same time I haven't had any problems with data- attributes they always work as expected, and escaped differently... Very strange as they are all html attributes right?
PS: your forum software is translating code to html, so I'm attaching an image to make myself clear: here
Your code seems to work correctly. I don't think that the problem you're facing is with the escaping. The browser unescapes the code before evaluating your JS.
Just make sure you have a data-article-id attribute defined on the image.
Wow... How did you test it? As pure html+js? I'm using Knockout for templates... Things are a bit complicated. When I correct the escaped characters things are working as they should. I think we shouldn't argue about VS Code linter, just have to do it right.