Re: [html-tests] HTML: Add simple test of focus event targets (#2571)

Reasoning for why we should expect exactly 1 `focus` event, with the `<input>` as its target:

`input.focus()` runs https://html.spec.whatwg.org/multipage/interaction.html#focusing-steps

None of the special cases apply, so we just run **focus update steps** with the *focus chains* **old chain** and **new chain**.

---

https://html.spec.whatwg.org/multipage/interaction.html#focus-chain

This part is tricky to follow, but my reading of the spec is that, in our particular case:
```
old chain = [body, Document]
new chain = [input, Document]
```

---

https://html.spec.whatwg.org/multipage/interaction.html#focus-update-steps

> (2) If the last entry in **old chain** and the last entry in **new chain** are the same, pop the last entry from old chain and the last entry from new chain and redo this step.

In our case, `Document` is the last entry in both chains, so we pop it off to yield:

```
old chain = [body]
new chain = [input]
```

And then the relevant part of the rest of the algorithm is to iterate over the old chain and fire `blur` events,
and later iterate over the new chain and fire `focus` events.

So, there should be exactly 1 `focus` event, targeted at `<input>`.

View on GitHub: https://github.com/w3c/web-platform-tests/pull/2571#issuecomment-182788181

Received on Thursday, 11 February 2016 10:00:15 UTC