mustang2247 / svgweb

Automatically exported from code.google.com/p/svgweb
Other
0 stars 0 forks source link

document.onkeydown doesn't work inside of SVG file for Flash renderer #433

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
If you bring in an external SVG file using the OBJECT tag, and have SCRIPT
in that SVG file as follows (pseudocode):

<svg>
  <script>
    function runMe() { alert('key pressed!'); }

    document.onkeydown = runMe;
  </script>
</svg> 

The document.onkeydown does not work with the Flash handler. I'm imagining
that the onkeydown is getting assigned to our fake _Document rather than
the real one. A workaround is possible:

top.document.onkeydown

Which works, confirming why its breaking. This issue comes up with porting
JessyInk (Issue 391).

This probably also affects the other document oriented events, such as
scroll wheels, onkeyup, onkeypress, etc.

Original issue reported on code.google.com by bradneub...@gmail.com on 1 Dec 2009 at 12:22

GoogleCodeExporter commented 8 years ago
Note that document.addEventListener('keydown', runMe, false) works now as of 
r1226.

Original comment by grick23@gmail.com on 8 Aug 2010 at 4:29