We've moved discussions to Discord

clipboard.js "TypeError: n is not a function"

Ugurcan Kaya
I get TypeError: n is not a function from clipboard in console.  Seems like there is a bug in the library

How about we replace it with a stimulus controller? 

In fact, stimulus handbook has a tutorial for this:
https://stimulusjs.org/handbook/building-something-real
Chris Oliver
What's the actual error?
Chris Oliver
Also Document.execCommand is obsolete according to MDN.

This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

Ugurcan Kaya
You are right, it is documented as obsolete.  Here is a screenshot. I see it in Firefox Developer 73.0b8  and Chrome 79

Don't you think it is better to use stimulus controllers for functionality that is only required for only certain parts of the app though? What are your thoughts on that?

Untitled-1.jpg 92 KB



Chris Oliver
I don't get that error in Firefox on JumpstartRails.com and clipboard functionality is working just fine.
Ugurcan Kaya
Ok 👍 something else in my app is causing it then. 
Chris Oliver
Let me know if you find any more info on it. 👍
Hari Prasad
Hi Ugrucan, have you got any solution for this. I am also facing the same error and got stuck with it for the past 2 days. Guys please help me out
Screenshot from 2020-01-31 19-45-21.png 52.4 KB
Notifications
You’re not receiving notifications from this thread.