Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid JS #14

Open
dantasa opened this issue Nov 19, 2013 · 0 comments
Open

Invalid JS #14

dantasa opened this issue Nov 19, 2013 · 0 comments

Comments

@dantasa
Copy link

dantasa commented Nov 19, 2013

Languages.current = (yt && yt.config_ && yt.config_.HL_LOCALE && Languages[yt.config_.HL_LOCALE]) || Languages[document.documentElement.getAttribute("lang")] || Languages.en;

This does the following:
Fails to find yt and throws an error (yt is not defined).

window.hasOwnProperty('yt') or window['yt'] should work (technically... scopes and globals are a bit confusing... window has root scope and globals are declared as root; so among the many objects that have root scope yt is a 'property' of them all.) *Or, I guess, even window.yt; but I greatly dislike directly accessing an undefined property; (Technically, I guess that javascript just treats it as ['property_name'], with the exception of declaring the string object... but it is kind of... yeah)

Error popped up under Opera 12.*
https://www.youtube.com/watch?v=9dgSa4wmMzk (Download Icon Missing, yt not declared)

It seems that the script is running before the DOM is fully initialized, (a second error that occurs "watchSentimentActions.appendChild(buttonGroup);" watchSentimentActions is null). It may be my screwing up things, but yeah...

*I should note that the error occurs under https specifically, otherwise the script runs fine. (As I said, loading before the DOM completed may be my screwing things up; but the above issue is not)

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

No branches or pull requests

1 participant