How does this JS trick work?

To this page, almost anywhere on the page, if you copy, you will get a line Read more at http://added to the end of your copy. I was wondering how. Looking at the source (post-copypaste.js) and setting a breakpoint, I did not understand. This area seems to fire when I select text.

I tried to look at the DOM (by viewing the selected source in firefox) and I did not see the text in dom. So this should be a javascript trick. I can imagine how to catch the C control event (I don’t know if this is what happens), but I can’t imagine how you can add or influence the text to be compiled, since it belongs to dom. I do not see flicker or anything.

How does this JS trick work or how to debug it to figure it out?

+5
source share
1 answer

But the inconvenient thing is that the choice in the correct / dom window does not seem to be affected.

This, but just not visible. What usually happens is there is a container somewhere else on the page (not necessarily visible). The content you selected is pasted there, then expanded, then copied and deleted from the container. This takes a fraction of a second, and by the time you paste it somewhere, your clipboard is already saving advanced content.

, , div pw-root. <div class='pw-root'></div> (, Firebug, ) , , .

0

All Articles