Developer forum

Forum » Swift » Add to favorites not working with selector has a dot (.)

Add to favorites not working with selector has a dot (.)

Pedro Meias
Pedro Meias
Reply

Hello,

Please refer to the following code at Templates/Designs/Swift/Assets/_src/js/_favorites.js

var clickedButton = e.currentTarget != undefined ? e.currentTarget : document.querySelector('#' + e);
var form = e.currentTarget != undefined ? clickedButton.closest('form') : document.querySelector('#' + e);

document.querySelector does not handle dots pretty well. If the selector is for example FavoriteToggleForm_101241UVO48.UVO339.UVO164.UVO55 the querySelector will return a null value.

Let me know if a video is needed.

Thank you

 


Replies

 
Merethe Vrå Andersen Dynamicweb Employee
Merethe Vrå Andersen
Reply

Hi,

I guess that it's the same that I have reproduced: https://www.screencast.com/t/ZIwQlAgV9

It is bugged in no 15294

Kind regards,
Merethe

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

HI Merethe,

 

I looked at your screencast and the error message in the console is different than the one we get. Not sure if it's related to having a single favorite list (our case) whereas in your example you have 2. Maybe it would be best to test with both scenarios.

https://app.screencast.com/es5ViXQzS05Hi

 

Best Regards,

Nuno Aguiar

 
Merethe Vrå Andersen Dynamicweb Employee
Merethe Vrå Andersen
Reply

Hi Nuno,
I can't reproduce the excact error on our main branch, but I'll add your video to the bug for the developer to look at.

/Merethe

 

 

You must be logged in to post in the forum