- This topic has 9 replies, 2 voices, and was last updated 2 years, 11 months ago by Branden Coker.
-
AuthorPosts
-
2022-01-05 at 6:07 pm #48472Branden CokerCustomer
I’m running into an issue that I dealt with a few months ago, but was never able to resolve.
I’d like to use the target.id of an element in my parent document as an argument in Verge puzzles.
These puzzles work:
These do not:
When I attempt to replace the “availability” var with my target.id, it no longer works. The target.id I’m clicking in this example is indeed named exactly the same as the var in Verge puzzles, but it seems I’m missing something in the jump from parent doc to local (Verge) doc. Any help would be greatly appreciated.
2022-01-05 at 6:08 pm #48473Branden CokerCustomerImages:
Attachments:
You must be logged in to view attached files.2022-01-06 at 1:36 am #48479Branden CokerCustomerAfter digging around a bit more, I realized that the “variable value by name” puzzle may be the answer to my problem. I’ve managed to get this working, but now I’m running into another issue.
This works:
While this works for all the elements in my parent HTML doc, when I attempt to use it with an element named “performance” I get unexpected results in the app and console.
Normal output to the console with the above puzzle is a list of items from the corresponding variable. However when I attempt to use the “performance” element, I get this:
Looks like debug info, but I’m not sure where it’s coming from. The obvious workaround is to change my element ID to something other than “performance,” but that would affect a lot of different files on our end. Hoping there is another solution.
Attachments:
You must be logged in to view attached files.2022-01-06 at 1:42 am #48484Branden CokerCustomerFor clarity, this can be reproduced with the following puzzles:
Attachments:
You must be logged in to view attached files.2022-01-06 at 8:25 am #48490Yuri KovelenovStaffHi Branden,
Indeed, performance is a built-in global variable
https://developer.mozilla.org/en-US/docs/Web/API/performance_propertySo when you name an HTML element as “performance”, it conflicts with the existing global variable, and that’s why the puzzle returns the original variable which is of no use for you.
I suggest you try the following trick. Instead of using that variable value by name puzzle, you just add an empty Text value to the result of the get event property puzzle. See if it helps.
2022-01-06 at 2:02 pm #48501Branden CokerCustomerYuri, thanks for the reply. Good to know regarding the built-in performance variable. I had no idea.
As for adding empty text value to the target.id, what’s the best way to do that? I still need to be able to use this in a for loop puzzle.
2022-01-06 at 3:03 pm #48505Yuri KovelenovStaff2022-01-06 at 3:31 pm #48506Branden CokerCustomerNot working for me. I can’t use the text puzzle in the loop input. I also tried reverting back to my original approach at the start of this thread. Couldn’t get this to work by passing the text block to an argument in a procedure either.
Attachments:
You must be logged in to view attached files.2022-01-07 at 11:50 am #48517Yuri KovelenovStaff2022-01-10 at 3:16 pm #48595Branden CokerCustomerHi Yuri, unfortunately, that’s not working either. I’m working around it now by using an if statement to single out the returned value of “performance.” A more elegant solution would certainly be welcome though.
-
AuthorPosts
- You must be logged in to reply to this topic.