Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

JSDOMParser: Element is missing a lang accessor

オープン 初心者向け
#1,026 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

@josuesto がすでに取り組んでいます。

2026年10月8日 から。

  • #1028 @afonsojanu による — マージされずにクローズ
  • #1035 @josuesto による — オープン

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
76/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
javascript
領域
web-dev

調査の方向性

JSDOMParser の Element の属性アクセサーを見つけ、周辺の実装を調査します。issue に示されている lang プロパティの動作を追加し、その後 documentElement.lang が lang 属性を反映し、そこへの代入によって属性が更新されることを確認します。

索引モデルが issue の本文から書いたものです。

説明

JSDOMParser's Element reflects several HTML attributes as properties such as className, id, href, src, srcset, but not lang. Code that reads doc.documentElement.lang gets undefined on a JSDOMParser document, and the language tag on a real DOM document.

Readability itself is not broken by this. It reads the value with getAttribute("lang") (Readability.js:1071) and exposes it as lang on the parse result. The problem hits consumers that take a document back from JSDOMParser and read the DOM property.

Firefox for Android's Reader View hit exactly this. It caches a parsed document, reloads it through JSDOMParser, and read doc.documentElement.lang, which gave no language on the cached path. We worked around it with getAttribute, but the accessor is worth having so the parser matches the DOM.

See also: Bugzilla: https://bugzilla.mozilla.org/show_bug.cgi?id=2062976

Suggested fix

Add the accessor next to the others:

  get lang() {                                                                                                                                                                        
    return this.getAttribute("lang") || "";                                                                                                                                           
  },                                                                                                                                                                                  
                                                                                                                                                                                      
  set lang(str) {                                                                                                                                                                     
    this.setAttribute("lang", str);                                                                                                                                                   
  },
主要言語
JavaScript
スター
11.5k
フォーク
737
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

mozilla/readability のほかの issue

mozilla/readability の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。