Quiz

  1. Could you walk through the benefits of cloning again?

    Sure. For me, the benefits of cloning are:

    1. I'm writing HTML directly, not writing JS that writes HTML.
    2. I can preview the result in a web browser to see if it's what I want
    3. I can fiddle with the CSS for it
    4. I can use Validators and WAVE to check my work, and
    5. all of this is before even thinking about JS, so finally,
    6. My JS is very simple:
      1. clone the HTML,
      2. fill in the dynamic data, and
      3. add the modified clone to the page
    7. That means my JS code doesn't get more complicated if the HTML gets more complicated.
  2. I am a bit confused about event handlers, what they're doing, how they're working, what exactly delegation is, etc.. Could we go over them some more in class?

    For sure! There are two parts to your question:

    • event handlers: functions associated with events, so we can do stuff as a consequence of user actions. We saw that last week with the colors/flowers example, and last time with the form submission handlers.
    • delegated event handlers. That's new this time, and can be more efficient when you would otherwise have hundreds/thousands of event handlers. For example, a page with 100 posts on it, each of which has a "like" button and maybe a "save" button and other buttons.
  3. None :)

    Amazing!