All good things

Soo… Unfortunately I havent finished the bug… :X

But I do have a mentor now Mr. Tim Taubert, a man out in Germany, unfortunately for me because I have a small window where I can ever talk to him. He’s helped me understand the bug a bit more, but to be frank I didn’t really know what to do with the information and i cant seem to get a hold of him for the moment but thats ok, as for right now I do have a direction. It’s likely the wrong direction but I’m going that one.

Generally speaking I can say that I was wrong in my last two blog posts about how this whole bug works. Particularly about how the cells move. I didn’t write the code and I barely know JavaScript as it is but I know now. The problem is that for whatever reason when dragging a cell out of the browser the cell will no longer register a drop function. I actually have zero idea as to why that is. I registers the dragend function and the dragover function but the function that unlocks the grid just is not being called. So since the remaining cells don’t unlock, they don’t return to their original position and we got a bug.

As of right now I’ve written some code that can detect when the mouse leaves the window with what’s called EventListeners.

  function mouseOut(){
    document.addEventListener('mouseout', function(){
          alert('left window');
          document.removeEventListener('mouseout');
              });
            }
  window.onload = mouseOut

Once I got that figured and working within a test HTML file. I’ve tried putting it within the dropTargetShim.js file and can’t seem to place it in the right spot. My first instinct was to place it within the dragover function but all that ended up happening was It was adding several instances of the function to the Document while it was dragging. basically about 100 or so per second or 2. (This was before I added the remove.EventListener part of the code.) So basically when it adds that many instances the event listener to the document it creates an alert for each instance, and all of those alerts will apear simultaneously when you move your mouse outside of the browser, and will create all of them again when you move your mouse out of the browser again. However, the number of alerts do NOT scale linearly but rather exponentially, meaning:

  • 1 instance = 1 alert
  • 2 instances = 2 alerts
  • 3 instances = 8 alerts
  • 4 instances = 16 alerts
  • etc.

If I was creating about 100 instances per second, I’m amazed I didn’t just crash my computer. So I added the removeEventListener to the code. And this is where I am right now. I’ve been adding this code to different functions within the dropTargetShim.js file and modifying it to fit, but have yet to have it make an alert when i drag a cell out of the browser. It’s made alerts when i move the mouse outside of a cell or just works the way it does in the html file, but i don’t think this code is quite it. It’s close, it’s damn close but its not quite what I need it to be.

Unfortunately this is the last week of project Ascend and I’ve learned so much, I can honestly say that working on this bug has been one of the most interesting puzzles that I’ve struggled with. And I will continue to work on this bug even though I won’t be showing up to Mozilla for a while.