How does :first-of-type determine type?

Following are a series of elements inside a div. Which match :first-of-type (and thus have a lime background)?

(1) This is a p element in the HTML namespace. It should definitely match.

(2) This is a second p element in the HTML namespace. It should definitely NOT match.

(3) This is an html:p element in the HTML namespace.

(4) This is a p element in the http://www.example.com/ns namespace.

(5) This is a p element in no namespace.

If type refers to the expanded name, then (1), (4), and (5) should be green. (But if xmlns="" is not supported, (5) will not be green.)

If type refers to the local name, then (1) should be green.

If type refers to the qualified name then (1) and (3) should be green.