patrickmestabrook/rawJStictactoe — pull request #1 by alliejones (2013-02-26 18:34:08+00:00)
Title: Use event bubbling so you don't have to attach an event handler to every table cell

I changed things so that the event handlers are attached to the `table` element instead of every `td`, and the handlers are defined in the script file instead of inline. (Inline handlers don't have access to the event object you can use to determine the element that triggered the event.)

So now when you click/mouseover/mouseout on a `td`, the event bubbles up to the parent `table` element and calls the handler function. Then `event.target` (`event` is the first argument passed to the function) is set to the element which triggered the event. (You should probably add a check in case something other a `td` is clicked, but it works fine here without it since all the child elements are `td`s.)