Can not copy empty string (vue.js)
See original GitHub issueWhen data-clipboard-text has empty string (‘’), nothing is copied to the clipboard and the previous clipboard value is not removed.
<button id="cp1" data-clipboard-text="something">Copy</button>
<button id="cp2" data-clipboard-text="">Copy</button>
Expected: After click on cp1, clipboard contains “something”. After click on cp2, clipboard contains “” (empty string) OR nothing.
Actual: After click on cp1, clipboard contains “something”. After click on cp2, clipboard contains “something”.
Issue Analytics
- State:
 - Created 7 years ago
 - Comments:10 (5 by maintainers)
 
Top Results From Across the Web
Vue Js: empty string when posting to API - Stack Overflow
log i'm getting NaN empty data stored in remaininginst and it's not posting due to this error.. am i doing something wrong here?...
Read more >Vuejs is converting "null" to string [ SOLVED ] - Laracasts
However, I would like vuejs to take this as an empty string and not a "null" string. For example, I take it like...
Read more >Avoid Empty Class in Vue with Null | SamanthaMing.com
Scenario 1: Using Empty String ''. We are using a ternary operator to conditional set the appropriate class depending on if isBold is...
Read more >String.prototype.slice() - JavaScript - MDN Web Docs - Mozilla
slice() extracts the text from one string and returns a new string. Changes to the text in one string do not affect the...
Read more >Template Syntax | Vue.js
Note that you cannot use v-html to compose template partials, because Vue is not a ... It will also be included if the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I still disagree that it’s a good idea to replace a user’s clipboard with empty information but that doesn’t really matter. Feel free to save an empty space using Clipboard.js or use
execCommanddirectly to achieve the behavior you’re looking for.In general, every action should support undo to default state. And after all, empty string is just ordinary string, why the special behavior? clipboard.js is universal tool, not final implementation of specific use case.