Anything that’s ever inside a tag with some attribute (eg. no-perchance) would not be evaluated whatsoever. This could be an easy way to allow creators to skip evaluation for entire sections of their page when they know they never want stuff in there evaluated. Also saves processing time looping through those elements (presumably), etc.

Or potentially, even provide a $ignoreHtmlSelector property (defaulting to [no-perchance] perhaps) to let the creator straight-up tell the engine what to ignore.

You could use the .closest(selector) on a node to figure out if it’s in an ignored element. Or perhaps do a document.querySelectorAll(":not(" + $ignoreHtmlSelector + ")") to find only the elements you need to evaluate within and loop over those.

  • wthit56@lemmy.worldOP
    link
    fedilink
    English
    arrow-up
    1
    ·
    2 months ago

    Ah, good idea! So it seems you essentially have some sort of “skip script tags” in place already. Hopefully it’s just a case of expanding that, when the time comes.

    Honestly, it’s still very mind-bendy trying to guess at what will and won’t be evaluated, and when I need to pre-evaluate or pre-escape or not do anything at all. The fact things work differently if done with a code block vs script also complicates things in my brain.

    I pride myself on how fast I’m able to learn and internalise systems. But this aspect of perchance has been a real challenge 😅