question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can not copy empty string (vue.js)

See original GitHub issue

When 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:closed
  • Created 7 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
zenorochacommented, Jun 11, 2016

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 execCommand directly to achieve the behavior you’re looking for.

2reactions
misogcommented, Jun 11, 2016

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found