I’m not sure if this is a bug or what, but there’s something unexpected going on.

I’ve set up a test for you to see here: https://perchance.org/sxvghvl53i#edit

I’ve got an $output that creates HTML, which contains the code [a.html], but escaped so that it’s not processed. So: \[a.html\].

This is then injected into the page, and actually processed correctly, replacing the contents with the a.html value. But then calling update() on that element either does nothing or throws an error of one kind or another.

It says that a_elem is undefined, when it should have already been injected into the page.

Honestly, I’ve been fiddling with this test for a while now and I can’t quite pin down exactly how it works or what this works and that doesn’t or what order things are being processed in… But some sort of shenanigans is going on.

If this is all working as expected, I’d love to learn how it works. But if not, consider this a bug report 😅

  • @wthit56OP
    link
    English
    13 months ago

    Could you explain why the escaped html works when the preview loads then? Because it seems to properly pick it up and evaluate it–just as if it were directly in the HTML pane unescaped. It just stops being properly picked up and evaluated after that.

    And if I don’t escape the [brackets], it would come out as plain text with just A anyway right? And still would not be updated correctly.

    • VioneTM
      link
      English
      13 months ago

      Using the $output seems to evaluate the expression first before displaying it on the HTML.

      You can try, instead of using $output, to use a variable like b, then use it like [a.b] or remove it from the list and just a separate variable [b] and it would not display the evaluated item, but escaped brackets.

      If you were to use $output, you can try to double escape it like \\\[a.html\\\] and it should output the same as using the b method.