$('input#network').on('paste', function (e) {
let pastedData = window.event.clipboardData.getData('text')
if (pastedData.includes('/')) {
let [network, netSize] = pastedData.split('/')
$('#network').val(network)
$('#netsize').val(netSize)
}
e.preventDefault()
});
First I noticed that my pasting data was being blocked most of the time. Appon analysis I found the issue was likely due to not trimming the pasted value. When double/tripple clicking a row in MacOS there is frequently a trailing whitespace of some kind which would end up causing the validation to fail.
Not to mention the preventDefault call was executing even when the pastedData didn't have a '/' char.
Also I get warnings about:
- javascript:S1874 Deprecated APIs should not be used
- CWE-477 - Use of Obsolete Functions.
First I noticed that my pasting data was being blocked most of the time. Appon analysis I found the issue was likely due to not trimming the pasted value. When double/tripple clicking a row in MacOS there is frequently a trailing whitespace of some kind which would end up causing the validation to fail.
Not to mention the preventDefault call was executing even when the pastedData didn't have a '/' char.
Also I get warnings about: