[Project_owners] DOMMouseScroll differs in HTML and XUL

Didier Ernotte didier at ernotte.com
Mon Sep 25 09:25:40 EDT 2006


Hi,

I need to capture the mouse wheel scroll event in my extension, and one user reports that it does not work with the trackpad. I have written a small sample file in HTML to see how it works and the same in XUL. It seems that the XUL implementation of the DOMMouseScroll does not capture the scroll from the trackpad. Does anybody knows how to capture the scroll from the trackpad ?
Thanks !

Didier

HTML

<html>
  <body>

    <form>
      <input type="text" id="box" value="move scroll wheel here">
    </form>

    <script>
document.getElementById("box").addEventListener("DOMMouseScroll", mouseScroll, false);

function mouseScroll(event)
{
  document.getElementById("box").value = event.detail;
}

    </script>
  </body>
</html>

In XUL

<?xml version="1.0" encoding="utf-8"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
        xmlns:html="http://www.w3.org/1999/xhtml">

<textbox id="box" value="move scroll wheel here"/>


<script type="application/x-javascript">
        
document.getElementById("box").addEventListener("DOMMouseScroll", mouseScroll, true);

function mouseScroll(event)
{
  document.getElementById("box").value = event.detail;
}

</script>

</window>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mozdev.org/pipermail/project_owners/attachments/20060925/f78ed853/attachment.htm


More information about the Project_owners mailing list