LoginSignup
4
5

More than 5 years have passed since last update.

HTML の要素は何種類?

Last updated at Posted at 2014-01-17
$ curl "https://raw.github.com/manakai/data-web-defs/master/data/elements.json" | jq '.elements["http://www.w3.org/1999/xhtml"] | to_entries | map (select ("1" == (.value.conforming | tostring))) | map(.key) | length'
112

HTML の要素は今112種類あります (廃止されたものを除く)。

(一覧はこちら → http://www.whatwg.org/specs/web-apps/current-work/multipage/section-index.html#elements-1 )

$ curl "https://raw.github.com/manakai/data-web-defs/master/data/elements.json" | jq '[.elements["http://www.w3.org/1999/xhtml"][].attrs[] | to_entries | map(select(.value.conforming | tostring == "1")) | map(.value.id) | map(select(. != null)) ] | map(.[]) | unique | length'
277

属性の数を数えるのはちょっと難しい (違う要素の同名の属性のどれを同じとみなすかによって変わる) のですけど、277種類 (+ ARIA 36種類) くらいあるようです (廃止されたものを除く)。

(ちなみにイベントハンドラー属性が73種類、全要素共通の属性が82+36=118種類、 input 要素の属性が82+33-1+36=150種類あります。)

4
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
5