Skip to content
This repository has been archived by the owner on Jan 12, 2020. It is now read-only.

Fix wrong id for transifex widget. #687

Closed
wants to merge 1 commit into from

Conversation

Ismael-VC
Copy link
Contributor

@Ismael-VC Ismael-VC commented Dec 8, 2017

Fixes:

Uncaught TypeError: Cannot read property 'appendChild' of null
    at (index):1072

@waldyrious
Copy link
Contributor

waldyrious commented Dec 8, 2017

Did you successfully test this? If I try it, it adds the link to the menu header, rather than as an entry in the list of languages.

I'm pretty sure the "tx-live-lang-picker" ID is the right one, but the script must wait until it is created dynamically before it runs. I'll see if I can introduce some sort of listener. I think we'll need to use the Mutation Observer API. I'll comment when I have more info.

@waldyrious
Copy link
Contributor

After some time reading about Mutation Observers. More than I would have liked, actually -- I ended up modifying the MDN example because, like everything else I was finding online, it included unnecessary complexity that made the basic concept harder to grasp.

Anyway, it looks like a possible way to fix this, although quite verbose (it will pretty much double the size of this script). I'll submit a PR with the proposed fix; hopefully it'll work out.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants