css - HTML button copies to clipboard as line feed -


suppose have <table> 6 columns. in each row, column 4 either contains <button> or nothing. columns 1-3, 5-6 contain text.

like so: https://jsfiddle.net/oq3uhhfe/

i able highlight table data in browser window, copy clipboard, , paste application (excel, notepad, etc). however, <button> appears act line feed/break. example, copy/pasting table provided in jsfiddle above gives me following output:

one     2     3    5    6 1     2     3       5    6 

the bottom row works like, top row not. not appear though adding &nbsp; cell <button> helps, nor applying -bla-user-select styles either <button> or <td>.

is there way this?

i guess comes down "different browsers behave differently."

to illustrate further, let me change fiddle use hidden buttons instead of empty cell. radically different results between chrome, firefox, , internet explorer:

https://jsfiddle.net/wxx70xu6/

firefox pasted notepad:

one     2     3    5    6 1     2     3       5    6 

chrome pasted notepad:

one 2 3   click   5    6 1 2 3       5    6 

internet explorer pasted notepad:

one 2 3 click  5 6  1 2 3   5 6  

even more interesting internet explorer behaves differently in excel in notepad. notepad shows above output, while excel shows "click" in both rows.

thanks replied.

edit: can access clipboard through .net clipboard class. getdata method lets retrieve data in 1 of many formats.

when viewing clipboard "text" format, copied value looked output notepad (above).

viewing clipboard "html" format, i'm assuming excel uses, produces following:

internet explorer

version:1.0 starthtml:000000203 endhtml:000001132 startfragment:000000740 endfragment:000001084 startselection:000000760 endselection:000001074 sourceurl:https://fiddle.jshell.net/wxx70xu6/show/ <!doctype html> <html><head> <script src="/js/lib/dummy.js" type="text/javascript"></script>              <link href="/css/result-light.css" rel="stylesheet" type="text/css"> <style type="text/css">     table {   border-collapse: collapse; }  td {   border: 1px solid #777777;   padding: 10px; }  .hidden {   display: none; }   </style>    <title></title> <script type="text/javascript">//<![cdata[ window.onload=function(){  }//]]>  </script>    </head><body><table><tbody><!--startfragment--><tr class="datarow"><td>one</td><td>two</td><td>three</td><td><button name="clicker" type="button" value="click">click</button>     </td><td>five</td><td>six</td></tr><tr class="datarow"><td>one</td><td>two</td><td>three</td><td><button name="clicker" class="hidden" type="button" value="click">click</button>     <td>five</td><td>six</td></tr><!--endfragment--></tbody></table></body></html> 

firefox

version:0.9 starthtml:00000149 endhtml:00000566 startfragment:00000183 endfragment:00000530 sourceurl:https://fiddle.jshell.net/wxx70xu6/show/ <html><body> <!--startfragment--><table><tbody><tr class="datarow"><td>one</td>     <td>two</td>     <td>three</td>     <td></td></tr></tbody></table><table><tbody><tr class="datarow"><td>five</td>     <td>six</td>   </tr>   <tr class="datarow">     <td>one</td>     <td>two</td>     <td>three</td>     <td>     </td><td>five</td>     <td>six</td></tr></tbody></table><!--endfragment--> </body> </html> 

chrome

version:0.9 starthtml:0000000157 endhtml:0000001709 startfragment:0000000193 endfragment:0000001673 sourceurl:https://fiddle.jshell.net/wxx70xu6/show/ <html> <body> <!--startfragment--><table style="border-collapse: collapse; color: rgb(0, 0, 0); font-family: &quot;times new roman&quot;; font-size: medium; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"><tbody><tr class="datarow"><td style="border: 1px solid rgb(119, 119, 119); padding: 10px;">one</td><td style="border: 1px solid rgb(119, 119, 119); padding: 10px;">two</td><td style="border: 1px solid rgb(119, 119, 119); padding: 10px;">three</td><td style="border: 1px solid rgb(119, 119, 119); padding: 10px;"><button name="clicker" type="button" value="click">click</button></td><td style="border: 1px solid rgb(119, 119, 119); padding: 10px;">five</td><td style="border: 1px solid rgb(119, 119, 119); padding: 10px;">six</td></tr><tr class="datarow"><td style="border: 1px solid rgb(119, 119, 119); padding: 10px;">one</td><td style="border: 1px solid rgb(119, 119, 119); padding: 10px;">two</td><td style="border: 1px solid rgb(119, 119, 119); padding: 10px;">three</td><td style="border: 1px solid rgb(119, 119, 119); padding: 10px;"></td><td style="border: 1px solid rgb(119, 119, 119); padding: 10px;">five</td><td style="border: 1px solid rgb(119, 119, 119); padding: 10px;">six</td></tr></tbody></table><!--endfragment--> </body> </html> 

Comments

Popular posts from this blog

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -