Command line scope

Forums » Dev.Opera » Opera Dragonfly Discussions

You need to be logged in to post in the forums. If you do not have an account, please sign up first.

Go to last post

8. April 2010, 19:50:28

snoozerman

Posts: 11

Command line scope

Hi,
Evaluating 'this' at the Dragonfly command line or in evaluated code seems not to be in the same scope.
Example:
<html>
  <head>

    <script type="text/javascript" >
      function onClick() {
        // Javascript alert shows [object HTMLDivElement] while
        // typing 'this' (at a breakpoint) at the command line
        // outputs [object Window] - why?
        alert(this);  
      }
      function RunTest() {
        var elm = document.getElementById('box');
        elm.onclick = onClick;
      }
    </script>

  </head>


  <body onload="javascript:RunTest()">
    <div id="box" >
      Add a breakpoint in Dragonfly the click here to test!
    </div>
  </body>

</html>


Why doesn't the command line output [object HTMLDivElement]? The property window seems to refer to the div.


Regards
Markus

9. April 2010, 01:04:14

aleto

A Man from Zuerich

Posts: 1864

This is a clear bug. Could you report it here https://bugs.opera.com/wizard/ ?

9. April 2010, 05:46:06

snoozerman

Posts: 11

Ok. It's done. Thank you.

Forums » Dev.Opera » Opera Dragonfly Discussions