Skip to content
Snippets Groups Projects
Commit a2ebc05c authored by Franck Plazanet's avatar Franck Plazanet Committed by Franck Plazanet
Browse files

[FIX] website: use currentTarget onLangChangeClick


Before this commit, in case of Google Translate is enable, some content
can be wrapped in extra node.

Use currentTarget is more secure to get the right element clicked.

**Steps to reproduce:**
1. Add a website and multiple language
2. Create a page in 2 languages
3. Visit the website in Chrome and enable the translation by Google translate
4. Change the language and you should get an error similar to:

Error:
Uncaught TypeError: Cannot read property 'replace' of undefined

closes odoo/odoo#61116

Signed-off-by: default avatarJérémy Kersten (jke) <jke@openerp.com>
parent e166357b
Branches
Tags
No related merge requests found
......@@ -102,7 +102,7 @@ var WebsiteRoot = publicRootData.PublicRoot.extend({
_onLangChangeClick: function (ev) {
ev.preventDefault();
var $target = $(ev.target);
var $target = $(ev.currentTarget);
// retrieve the hash before the redirect
var redirect = {
lang: $target.data('url_code'),
......
Vietnam, 2020-11-02
I hereby agree to the terms of the Odoo Individual Contributor License
Agreement v1.0.
I declare that I am authorized and able to make this agreement and sign this
declaration.
Signed,
Franck Plazanet franck@plazanet.ovh https://github.com/pfranck
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment