回答編集履歴
1
getElementsByTagName が存在する Interface について
    
        answer	
    CHANGED
    
    | 
         @@ -1,13 +1,17 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ### getElementsByClassName
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            > ```JavaScript
         
     | 
| 
       3 
4 
     | 
    
         
             
            > var x = document.getElementsByClassName(クラス名).getElementsByTagName("a");
         
     | 
| 
      
 5 
     | 
    
         
            +
            > ```
         
     | 
| 
       4 
6 
     | 
    
         | 
| 
       5 
7 
     | 
    
         
             
            `getElementsByClassName` が返す値は `HTMLCollection` です。
         
     | 
| 
       6 
8 
     | 
    
         
             
            HTMLCollection には `getElementsByTagName` は生えていませんので、そのコードはエラーになります。
         
     | 
| 
      
 9 
     | 
    
         
            +
            getElementsByTagName は `Document.prototype.getElementsByTagName` もしくは `Element.prototype.getElementsByTagName` に存在しますので、対象が `document` オブジェクトもしくは要素ノードでなければ使用できません。
         
     | 
| 
       7 
10 
     | 
    
         | 
| 
       8 
11 
     | 
    
         
             
            - [3.5. インタフェース Document - DOM Standard 日本語訳](https://triple-underscore.github.io/DOM4-ja.html#interface-document)
         
     | 
| 
      
 12 
     | 
    
         
            +
            - [3.9. インタフェース Element - DOM Standard 日本語訳](https://triple-underscore.github.io/DOM4-ja.html#interface-element)
         
     | 
| 
      
 13 
     | 
    
         
            +
            - [3.2.10.2. インタフェース HTMLCollection - DOM Standard 日本語訳](https://triple-underscore.github.io/DOM4-ja.html#interface-htmlcollection)
         
     | 
| 
       9 
14 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
15 
     | 
    
         
             
            ### querySelectorAll
         
     | 
| 
       12 
16 
     | 
    
         | 
| 
       13 
17 
     | 
    
         
             
            Selectors API を使えば、目的の動作は達成できます。
         
     |