'Weird Chrome bug?

This bug is probably not reproducible (edit:so I thought). I have a textarea with onkeyup and oninput, when I ctrl-v paste something into the textarea it gets pasted twice and the oninput event fires twice. Pasting with mouse context menu works fine though. Then I change the name of onkeyup to onkeyup_ to temporarily avoid that it fires to see what changes, nothing changes. Then I test just to make sure that the onkeyup_ event isn't firing; onkeyup_="alert('This shouldn\'t fire')". Now when I'm trying to paste text into the textarea instead of getting the text I pasted the text "This shouldn\'t fire" shows up in the textarea instead, no alert window is created by the alert, instead it dumps it's argument into the textarea, weird.

When pasting with ctrl-v the text is added twice and oninput fires twice, when pasting with the mouse context menu the text appears only once. But now comes the weird part, I delete the onkeyup_ event completely, but it keeps firing even if it's not present in the code anymore! And when I "inspect element" I indeed confirm that the alert code is no longer in the html, but it keeps firing, and it keeps dumping it's argument into the textarea instead of displaying it in an alert window. How can Chrome execute code that's no longer there? Does it keep some kind of copy of an old version, and I've made many changes so far and Chrome gets the new version of the file. And why is alert not working as supposed to?

Edit:
Phew, it was hard to track down (I got a lot of code), but this reproduces the bug on Chrome, but works fine on Firefox:

<html>
<head>
<script>
function f(d){
alert(d.value);
}
</script>
<body>
<textarea name="commentBody" rows="8" cols="50" id="addVideo" oninput="f(this)" placeholder="Placeholder text..." style="margin-left: 0px; margin-right: 0px; width: 489px; margin-top: 5px; margin-bottom: 5px; height: 120px; "></textarea>
</body>
</html>

So the problem is to alert the value of the field? Why?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source