スクリプトのスクリプト

script 要素 (HTML)

[512] script 要素闇は深い

或る人曰く

[1] HTMLscript 要素は、動的なスクリプトや、 スクリプトが使うデータ文書に埋め込むものです。

仕様書

意味

[131] script 要素は、動的なスクリプトや、データブロックを文書に含めるために使うことができます。 >>130

[134] どちらであるかは type 属性language 属性によって決まります。 <script type> を参照。

[132] script 要素利用者に対する内容表現していません。 >>130

[186] script 要素は、次の通り分類されています。

構文

[188] 開始タグ終了タグ必須であり、省略できません >>130

文脈

[14] script 要素は、 フロー内容語句内容スクリプト支援要素のいずれかが求められる場面で使うことができます >>130。つまり HTML文書のほとんどあらゆる場所で使うことができます。

[187] HTML4 時代も大部分で使うことが認められていました HTML 4 18.2.1 が、 HTML5 で更に制約が緩和され、構文解析器等の都合で困難な場面を除き、 ほとんどすべての場面で使えるようになりました。

属性

[9] script 要素内容属性
[135] <script type> 依存の制約もあります (そちらの項を参照)。

[554] script 要素の意味に依存して、 使える属性は次の通り変化します。

semantics
意味
type
type
src
src
charset
charset
async
async
nomodule
nomodule
defer
defer
crossorigin
crossorigin
nonce
nonce
integrity
integrity
semantics
古典スクリプト
type
省略するべき
nomodule
charset
src 必須
async
src 必須
defer
src 必須 (async があると無意味)
crossorigin
src がないと無意味
nonce
integrity
src 必須
src
semantics
モジュールスクリプト
type
module
nomodule
禁止
charset
禁止
async
defer
禁止
crossorigin
nonce
integrity
禁止
src
semantics
データブロック
type
MIME型
src
禁止
charset
禁止
async
禁止
nomodule
禁止
defer
禁止
crossorigin
禁止
nonce
禁止
integrity
禁止

[249] async 属性src 属性については属性が追加された時の処理が規定されています。

[500] 属性の有無と構文解析器によって作成されたか DOM メソッドで作成されたかにより、スクリプトの実行のタイミングは次のように変化します。

e
要素
timing
実行時機
order
相対的順序保存
pause parser
構文解析器中断
c
>>360
e
<script>
order
はい
pause parser
はい
timing
挿入直後・妨害条件解消後の遅い方
c
己、戊
e
<script src>
order
はい
pause parser
はい
timing
fetch 直後・妨害条件解消後の遅い方
c
e
<script src defer>
order
はい
timing
構文解析終了直後・fetch 直後・妨害条件解消後の遅い方
c
e
<script src async>
timing
fetch 直後
c
e
<script type=module>
order
はい
timing
構文解析終了直後・妨害条件解消後の遅い方
c
e
<script type=module async>
timing
fetch 直後
c
e
<script type=module src>
order
はい
timing
構文解析終了直後・fetch 直後・妨害条件解消後の遅い方
c
e
<script type=module src async>
timing
fetch 直後
c
e
s = document.createElement ('script')
order
はい
timing
挿入直後・妨害条件解消後の遅い方
c
e
s = document.createElement ('script'); s.src = ...
timing
fetch 直後
c
e
s = document.createElement ('script'); s.async = false; s.src = ...
timing
fetch 直後・妨害条件解消後の遅い方
order
はい
c
e
s = document.createElement ('script'); s.async = true; s.src = ...
timing
fetch 直後
c
e
s = document.createElement ('script'); s.type = 'module'
timing
妨害条件解消後
c
e
s = document.createElement ('script'); s.type = 'module'; s.src = ...
timing
fetch 直後
c
e
s = document.createElement ('script'); s.type = 'module'; s.async = false; s.src = ...
order
はい
timing
fetch 直後・妨害条件解消後の遅い方
c
e
s = document.createElement ('script'); s.type = 'module'; s.async = true; s.src = ...
timing
fetch 直後
c

内容

[194] script 要素の種別が古典スクリプトモジュールスクリプトの場合は、 src 属性を使って外部スクリプト資源を指定することもできますし、 内容として直接埋め込むこともできます >>130

<script src> も参照。

[137] script 要素の種別がデータブロックの時は、 内容として直接埋め込まなければなりません >>130

[133] script 要素の種別については <script type> を参照。

言語依存の制約

[193] script 要素内容古典スクリプトモジュールスクリプトを表しているときは、 それぞれ JavaScriptScriptModule の制約に従わなければなりません >>130

[192] かつては次のような若干曖昧な規定でした。

[150] HTML Standard は共通の制約以外には script 要素内容について制約を課しておらず、 type (と language) によって決定される言語の仕様による制限に適合しなければならないとしています。

[151] ただし実際にはそのような制約を明示している仕様はありません。

[152] HTML Standard によれば、 script 要素src 属性がない場合、 script 要素内容

... 使うことになっています。ここから推測すると、

... という風に解釈するのが妥当でしょう。

[157] ただし HTML 構文では script 要素の構文解析直後の状態は常にテキスト節点を高々1つだけ含んだ状態になります。要素子供にするためには XML 構文を使うかスクリプトで挿入するしかありません。そのため、データブロックとして XML ベースのデータが script 要素内容に埋め込まれることがありますが、 XML のソースをテキスト節点として含んだ状態になってしまいます。


[139] script 要素の種別がデータブロックの時は、 type 属性で指定された書式の要件に従わなければなりません >>130

[581] しかし現実にはそのような書式を明確に規定している MIME型は、それほど多くありません。 既存の MIME型のほとんどは、 MIMEHTTP での利用を想定してバイト列の書式は定めているかもしれませんが、 文字列の書式を定めていることは稀です。 JavaScriptフレームワークの類の処理対象データを埋め込むために使う場合の専用の MIME型については、その書式が定義されているくらいです。

外部スクリプトについてのドキュメントの制約

[142] src 属性が指定されている場合、 script 要素内容は外部のスクリプトについてのドキュメントとみなされます。 スクリプトとして実行はされません。この場合には、 (スクリプト言語に関わらず) 次のものだけを使わなければならないという制約が課されます (空でも構いません) >>130

共通の制約

[140] script 要素textContent は次の要件を満たさなければなりません >>130

[141] HTML構文解析器script 要素内において <!----> の対応関係や <script></script> の対応関係を考慮して複雑な解釈を行います。それに反して HTML として直列化できない値や混乱を招くものを禁止するために >>140 のような規定があります。

擬似注釈宣言の使用

[18] script 要素に対応していない古い WWW ブラウザは、 script 要素内の文字データも構わず解釈してしまいます。 そこで、 script 要素の内容としてスクリプトを記述するときには、 HTML の注釈宣言のように最初に <!-- を、 最後に --> をつけることが慣習となっています。

HTML 4 によれば、これは HTML の機能ではなく、スクリプト機関の機能とされています。 この機能に対応している言語には JavaScript, VBScript, Tcl があるようです。 HTML 4 18.3.2 より正確には、この3つの言語は script 要素の内容の一番最初の非空白文字列が <!-- であるとき、これを無視するらしいです。 最後の --> は、3つの言語のいずれも、それだけで書くことはできず、 それぞれの言語の注釈の内容として (JavaScript の場合は // --> のようにして) 書くことが必要らしいです。

らしいというのは、正確にこれを規定した仕様がないからです。 HTML 4 はスクリプト機関によるものだと言っていますから、 スクリプト言語の言語仕様かなにかに規定があってもよさそうなものですが、 そのようなものは見たことがありません。また、 HTML に直接埋め込まれていない ECMAScript のスクリプトのソース・コードに <!-- という文字列があってもよいという話も聞きません。 (style 要素も同じような事情ですが、こちらは CSS2 で言語仕様の一部としてきちんと定義されています。)

[42] 少なくても JavaScript では、 最初の <!-- が含まれる行の行末までを無視するのが Web ブラウザの普通の実装のようです。

[27] このような注釈宣言 (のようなもの) の中では、 (SGML 的には CDATA なので注釈宣言ではないとはいえ、 古い UA の立場からしても SGML 的に正当であるために) COM (--) を含めるべきではないと考える人もいます。

[19] なお、 XHTML 1 の script 要素は、 CDATA ではありませんので、注釈宣言 (のようなもの) を書くと、 本当に XML の注釈宣言と解釈されてしまいます。当然、 スクリプトとして解釈・実行されることはありません。

[40] script 要素が使われ始めたばかりの1996年ごろまでは、 注釈宣言 (のようなもの) の閉じの前に

<script language="javascript">
<!-- hide script from old browsers
...
// hide script from old browsers -->
</script>

のように自然言語の注釈を入れておくことがよく行われていました (初期の使用例にそう載っていたからみんなで真似したのでしょう)。 (この例のように開き (のようなもの) の後に書くこともできましたが、 閉じの前に書くのが普通だったと記憶しております。) 後にこのような冗長なことはせず、

<script language="javascript">
<!--
...
//-->
</script>

のように簡単に書くようになりました。

[35] また、裏技的なものとして、

<script language="javascript">
<!--
...
// -->スクリプトに対応していません。<!--
...
// -->
</script>

のような書き方が紹介されることもありました。 (この例のようになぜかスクリプトの途中に書いているものもあれば、 注釈宣言 (のようなもの) の前後に書いているものもありました。 どこに入れるにせよ、書く内容は一行にするか、 うまくして行頭にスクリプト言語の注釈導入子が来るように調整することが重要です。 また、 etago が使えないことにも注意が必要です。)

[38] スクリプト言語の演算子として > を使うことが良くありますが、 古いブラウザの中には注釈宣言を > で終えてしまうものがあることが知られています。 x > y のような式は y < x と書くことで回避できます。 HTML 4 18.3.2 Note もっとも、そのようなブラウザは HTML 4 の時点でも骨董品ですし、 HTML 4 も特にそうするべきだなどとは言っていません。

参考文献:

誤って「//->」のようなもので終わることもあるみたいです。

適合性検査

[136] script 要素要素属性内容適合性の検査は、 次のように行えます。

  1. [292] 元の型を、要素type 属性値に設定します。
  2. [138] を、要素スクリプトブロックの型文字列に設定します。
  3. [195] により、
    [223] JavaScript MIME型のいずれか (ASCII大文字・小文字不区別)
    1. [224] 検査を、「Script としての検査」に設定します。
    2. [207] 元の型空文字列なら、
      1. [220] 不適合であると報告します。
    3. [225] それ以外で、元の型が null でなければ、
      1. [234] 原則として不適合であると報告します。
    4. [226] 要素async 属性defer 属性の両方があれば、 警告します。
    5. [484] 要素defer 属性があって src 属性がなければ、警告します。
    6. [499] 要素async 属性があって src 属性がなければ、警告します。
    7. [219] 要素crossorigin 属性があって src 属性がなければ、警告します。
    8. [218] 要素charset 属性があって src 属性がなければ、不適合を報告します。
    [196] module (ASCII大文字・小文字不区別)
    1. [293] 元の型module (ASCII大文字・小文字不区別) でなければ、不適合を報告します。
    2. [221] 検査を、「Module としての検査」に設定します。
    3. [198] 要素charset 属性があれば、不適合を報告します。
    4. [199] 要素defer 属性があれば、不適合を報告します。
    [197] それ以外
    1. [222] 検査を、によって決まる検査 (なければ null) に設定します。
    2. [202] 要素async 属性があれば、不適合を報告します。
    3. [200] 要素charset 属性があれば、不適合を報告します。
    4. [204] 要素crossorigin 属性があれば、不適合を報告します。
    5. [201] 要素defer 属性があれば、不適合を報告します。
    6. [205] 要素nonce 属性があれば、不適合を報告します。
    7. [203] 要素src 属性があれば、不適合を報告します。
    8. [206] 妥当なMIME型であるか検査します。
    9. [235] 引数を無視すると JavaScript MIME型になるなら、警告します。
    10. [236] がかつてスクリプト言語に用いられた値なら、警告します。
  4. [211] 要素async 属性があれば、検査します。
  5. [215] 要素charset 属性があれば、検査します。
  6. [212] 要素crossorigin 属性があれば、検査します。
  7. [216] 要素defer 属性があれば、検査します。
  8. [213] 要素nonce 属性があれば、検査します。
  9. [210] 要素src 属性があれば、検査します。
  10. [504] 要素language 属性があれば、
    1. [506] 要素language 属性値ASCII大文字・小文字不区別javascript と一致するなら、
      1. [505] 元の型が null か text/javascript (ASCII大文字・小文字不区別) なら、
        1. [509] obsolete but conforming を報告します。
      2. [510] それ以外なら、
        1. [511] 不適合を報告します。
    2. [507] それ以外なら、
      1. [508] 不適合を報告します。
  11. [209] 要素属性リストのうち、以上で検査していない属性を検査します。
  12. [244] 要素内容の共通の制約を検査します。
  13. [214] 要素src 属性があれば、
    1. [245] 要素内容のドキュメント制約を検査します。
  14. [208] 検査の値により、
    [233] null
    1. [228] 検査不能を報告します。
    [227]Script として検査」か「Module として検査」
    1. [237] 要素src 属性があれば、
      1. [239] 古典スクリプトのfetchを実行します。 URL要素src IDL属性の値、 CORS設定群要素crossorigin 属性値文字符号化要素charset 属性値とします。 続きの処理は、スクリプトについての次のような処理とします。
        1. [240] スクリプトソーステキストについて、検査を実行します。
        2. [243] charset を、 スクリプトの生成に使われた応答Content-Typeメタデータcharsetに設定します。
        3. [241] charset があり、要素charset 属性もある場合、
          1. [242] charset要素charset 属性とどちらも同じ符号化ラベルであるか検査します。
    2. [238] それ以外なら、
      1. [229] ソーステキストを、要素text IDL属性の値に設定します。
      2. [230] ソーステキストについて、検査を実行します。
    [231] それ以外
    1. [232] 要素について、検査を実行します。

状態

[246] HTML要素の状態に加えて、次の状態を持ちます。

「開始済み」 ("already started") フラグ
スクリプトが実行開始されたかどうかを表します。 初期状態では未設定です >>130。 実行された場合の他に、 内容の処理中に構文解析器EOF に遭遇した時や、 素片構文解析アルゴリズムの実行中の時 (innerHTML 等の時) にも設定されます。
「構文解析器挿入」フラグ
構文解析器が挿入した script 要素に設定されます。 初期状態では未設定です >>130
「非ブロッキング」 ("non-blocking") フラグ
他の script 要素スクリプトの実行との相対的な順序が保存されるべき (ブロッキング) か否か (非ブロッキング) の判断に使われるフラグです。 初期状態では設定され >>130async 内容属性が操作されると消去されます。
「構文解析器実行準備完了」 ("ready to be parser-executed") フラグ
初期状態では未設定です >>130
スクリプトの型
古典スクリプトモジュールスクリプトの別を表します。 初期状態では未設定です >>130
外部ファイルから (from an external file) >>130
外部スクリプトかどうかを表します。
スクリプトのスクリプト (the script's script) >>130
script 要素から得たスクリプトです。
スクリプトの準備完了
スクリプトのfetchの完了を表します。 それまでloadイベントが遅延されます。
準備完了フラグ
>>371 で利用されます。
作成した構文解析器
要素を作成した構文解析器スクリプトの準備で参照されます。 構文解析器 (Web) も参照。

[183] かつては次の状態がありました。

処理

[477] script 要素の処理は、 HTML要素の中でもトップレベルに複雑です。 イベントループはもちろん、 構文解析器とも密結合しています。

[412] 要素の作成時点で、作成方法により、次のように各フラグが設定されます。

create
作成方法
parser-inserted
「構文解析器挿入」
already started
「開始済み」
non-blocking
「非ブロッキング」
execute
スクリプト実行
create
createElement, createElementNS
parser-inserted
いいえ
already started
いいえ
non-blocking
はい
execute
はい
create
構文解析器
parser-inserted
はい
non-blocking
いいえ
execute
はい
already started
いいえ
create
構文解析器 (innerHTML, outerHTML, insertAdjacentHTML, createContextualFragment)
parser-inserted
はい
non-blocking
いいえ
already started
はい
execute
いいえ
create
xml-stylesheet で参照された XSLTスタイルシート >>130
parser-inserted
はい
already started
いいえ
non-blocking
?
execute
はい
create
transformToDocument >>130
parser-inserted
はい
already started
はい
non-blocking
?
execute
いいえ
create
transformToFragment >>130
parser-inserted
いいえ
already started
いいえ
non-blocking
?
execute
はい
create
cloneNode
already started
複製元と同じ
parser-inserted
いいえ
non-blocking
はい
create
作成後 setAttribute 等で async 内容属性追加
non-blocking
いいえ
create
作成後 async IDL属性に値を設定
non-blocking
いいえ

[479] 更に、要素文書に挿入された時点で、スクリプトの準備が行われます。 ただしスクリプトではなく構文解析器によって挿入された場合は、 (開始タグ時点で発生する) 挿入の時点ではなく、終了タグ時点で行われます。

[480] スクリプトの準備の後に、スクリプトブロックの実行で、 実際にスクリプトが実行されます。これは fetch など必要な条件が整った時に行われます。 (スクリプトの準備から直接呼び出されることもあれば、 構文解析完了時などかなり遅延される場合もあります。)

[481] これだけでも相当複雑ですが、構文解析器が挿入した script 要素スクリプトdocument.write を呼び出し、そこで構文解析器が再帰的に実行されて script 要素が新たに挿入される場合も考慮する必要があるので、 スパゲッティもびっくりなレベルで複雑に交錯しています。

構文解析器の処理

[414] 構文解析器は、 script 開始タグの処理において script 要素要素を作成した直後、 挿入する直前に、次のようにしなければなりません >>413, >>424

  1. [415] 要素「構文解析器挿入」フラグを設定します。
  2. [416] 要素「非ブロッキング」フラグを消去します。
  3. [417]構文解析器素片構文解析の場合、
    1. [418] 要素「開始済み」フラグを設定します。
  4. [556]構文解析器スクリプト入れ子文脈の場合、
    1. [557] 要素「開始済み」フラグを設定して構いません。 例えば、 異なる起源スクリプトdocument.write で挿入されていてネットワークが遅い場合や、 ページの読み込みに既に長時間を費やしている場合などに、 スクリプトを実行しないことにして構いません。
[425] HTML StandardXML構文解析器の処理において >>414スクリプトが有効な場合に限定していますが、 HTML構文解析器にはそのような制約はありません。 処理の整合性を考慮するとHTML構文解析器の動作が正しいと思われます。

[420] HTML構文解析器は、 "in text" 挿入モードscript 要素現在節点の時 EOF 字句を処理する場合には、 開いている要素のスタックから現在節点を除去する直前に、 次のようにしなければなりません >>419

  1. [421] 要素「開始済み」フラグを設定します。
[426] HTML Standard には XML構文解析器の処理でこれに相当する規定がありませんが、 整形式でなくても場合によってはスクリプトからアクセスできるとすると、 同様の扱いが必要と思われます。
[428] HTML構文解析器SVG script 要素を処理する際にも、同様の措置が必要かもしれません。

[423] 構文解析器構文解析器は、 script 要素要素現在節点である時、要素開いている要素のスタックから pop したり、挿入モードなど構文解析器の状態を適宜変更した直後に、 次のようにしなければなりません >>422, >>424

  1. [432] 構文解析器文書イベントループJavaScript実行文脈スタックが空なら、
    1. [433] 構文解析器文書イベントループについてマイクロタスクチェックポイントを実行します。
  2. [434] 旧挿入点を、構文解析器挿入点に設定します。
  3. [435] 構文解析器挿入点を、構文解析器次入力文字の直前に設定します。
  4. [436] 構文解析器スクリプト入れ子水準を、インクリメントします。
  5. [437] 要素についてスクリプトの準備を実行します。
  6. [440] 構文解析器スクリプト入れ子水準を、デクリメントします。
  7. [441] 構文解析器スクリプト入れ子水準が0なら、
    1. [442] 構文解析器parser pause flag を、に設定します。
  8. [443] 構文解析器挿入点を、旧挿入点に設定します。
  9. [465] 構文解析器pending parsing-blocking script の処理 (>>466) を行います。
[431] これは HTML構文解析器では "in text" 挿入モードscript 終了タグを処理する時に実行されます >>422XML構文解析器では script 要素開いている要素のスタックから pop した時に実行されます >>424整形式でない XML文書を考慮する場合は、仕様書に明文化されている場合の他、 複数の要素をまとめて pop する場合もあるかもしれません。
[464] HTML StandardXML構文解析器についてもう少し違った (より簡単な) 手順を示していますが、HTML構文解析器特有の内部状態が XML構文解析器にも存在すると考えれば、場合分けなく共通の処理にできます。

[430] FirefoxIE11HTML Standard に従いスクリプト実行前にマイクロタスクチェックポイントを実行するように見えます。 Chrome は実行しないように見えます。

DOM 操作の副作用

[250] 節点子節点節点の接続の処理は、 次のようにしなければなりません >>130

  1. [252] 子節点script 要素であり、 「構文解析器挿入」フラグが設定されていなければ
    1. [253] 子節点についてスクリプトを準備します。
  2. [254] 子節点script 要素であり、 子節点「構文解析器挿入」フラグが設定されていなければ
    1. [255] 子節点についてスクリプトを準備します。

[251] 節点の接続、すなわち影を含む文書中となったときに実行されます。 つまり文書木本体のみならず、影木への挿入でも script 要素は実行されます。

[247] clone 時の処理は、 cloning steps 参照。

スクリプトの準備

[257] 要素スクリプトの準備 (prepare a script) は、 次のようにしなければなりません >>130

  1. [258] 要素「開始済み」 ("already executed") フラグが設定されていれば、 ここで停止します。
  2. [259] 要素「構文解析器挿入」フラグが設定されていれば、
    1. [260] 構文解析器挿入だったを、に設定します。
    2. [263] 要素「構文解析器挿入」フラグを消去します。
    3. [267] 要素async 内容属性がなければ、
      1. [268] 要素「非ブロッキング」フラグを設定します。
  3. [261] それ以外なら、
    1. [262] 構文解析器挿入だったを、に設定します。
  4. [573] ソーステキストを、 要素子供テキスト内容に設定します。
  5. [269] 要素src 属性がなく、 子供テキスト内容空文字列の場合、
    1. [534] ここで停止します。
  6. [270] 要素影を含む文書中でない場合、
    1. [535] ここで停止します。
  7. [286] 要素スクリプトブロックの型文字列について、
    JavaScript MIME type essence match
    要素スクリプトの型を、classic に設定します。
    moduleASCII大文字・小文字不区別で一致
    要素スクリプトの型を、module に設定します。
    それ以外
    ここで停止します。
  8. [274] 要素「開始済み」フラグを設定します。
  9. [271] 構文解析器挿入だったなら、
    1. [272] 要素「構文解析器挿入」フラグを設定します。
    2. [273] 要素「非ブロッキング」フラグを消去します。
    3. [275] 要素節点文書要素を作成した構文解析器文書と異なるなら、
      1. [276] ここで停止します。
  10. [282] 要素についてスクリプトが無効なら、
    1. [548] ここで停止します。
  11. [550] 要素nomodule 属性があって、 要素スクリプトの型classic の場合、
    1. [551] ここで停止します。
  12. [283] 要素src 属性を持たない場合、
    1. [284] 結果を、要素scriptソーステキストについて Should element's inline behavior be blocked by Content Security Policy? を実行した結果に設定します。
    2. [288] 結果Blocked なら、ここで停止します。
  13. [289] 要素event 属性for 属性を持ち、 要素スクリプトの型classic なら、
    1. [290] 要素for 属性値が先頭と末尾の0個以上間隔文字を無視すると ASCII大文字・小文字不区別window と一致するなら、ここで停止します。
    2. [291] 要素event 属性値が先頭と末尾の0個以上間隔文字を無視すると ASCII大文字・小文字不区別onload または onload() と一致するなら、ここで停止します。
  14. [298] それ以外なら、
    1. [299] 符号化を、要素節点文書文書の符号化に設定します。
  15. [300] CORS設定を、要素crossorigin 属性状態に設定します。
  16. [568] オプション群を、 新しいスクリプトfetchオプション群に設定します。
    [516] スクリプトfetchオプション群
    暗号学的nonce
    要素nonce 属性が存在する場合、 nonce 属性値。 それ以外の場合、空文字列
    一貫性メタデータ
    要素integrity 属性が存在する場合、 integrity 属性値。 それ以外の場合、空文字列
    構文解析器メタデータ
    要素「構文解析器挿入」フラグなら parser-inserted、それ以外なら not-parser-inserted
    credentialsモード
    CORS設定から得た credentialsモード
    参照元ポリシー
    要素referrerpolicy 内容属性の現在の状態
  17. [301] 設定群を、要素節点文書Window環境設定群オブジェクトに設定します。
  18. [338] loadイベントの遅延 (>>248) を開始します。
  19. [302] 要素src 属性があれば、
    1. [303] src を、要素src 属性値に設定します。
    2. [304] src空文字列なら、
      1. [385] 要素のエラーを通知するタスクを追加 (>>305) します。
      2. [341] loadイベントの遅延 (>>248) を終了します。
      3. [386] ここで停止します。
    3. [308] 要素外部ファイルからフラグを設定します。
    4. [309] URL を、 src について要素節点文書に対してURLの構文解析を実行した結果URL記録に設定します。
    5. [310] URL が失敗なら、
      1. [387] 要素のエラーを通知するタスクを追加 (>>305) します。
      2. [388] loadイベントの遅延 (>>248) を終了します。
      3. [389] ここで停止します。
    6. [311] 要素スクリプトの型により、
      classic
      1. [294] 要素charset 属性を持つなら、
        1. [295] 符号化を、要素charset 属性値について符号化を取得した結果に設定します。
        2. [296] 符号化が失敗なら、
          1. [297] 符号化を、要素節点文書符号化に設定します。
      2. [522] それ以外なら、
        1. [523] 符号化を、要素節点文書符号化に設定します。
      3. [313] 古典スクリプトのfetchを実行します。
        URL
        URL
        CORS設定
        CORS設定
        オプション群
        オプション群
        設定群
        設定群
        符号化
        符号化
        続きの処理
        >>316
      module
      モジュールスクリプト木のfetchを実行します。
      URL
      URL
      オプション群
      オプション群
      設定群
      設定群
      終点
      script
      続きの処理
      >>316
  20. [327] それ以外の場合、
    1. [333] 基底URLを、 要素設定文書文書基底URLに設定します。
    2. [329] 要素スクリプトの型により、
      classic
      1. [331] 要素スクリプトのスクリプトを、 ソーステキスト設定群基底URLオプション群について古典スクリプトを作成した結果に設定します。
      2. [332] 要素スクリプトの準備完了とします。
      module
      1. [334] スクリプトを、ソーステキスト設定群基底URLオプション群についてモジュールスクリプトを作成した結果に設定します。
      2. [335] スクリプトが null なら、
        1. [336] 要素スクリプトのスクリプトを null に設定します。
        2. [337] 要素スクリプトの準備完了とします。
      3. [339] それ以外の場合、
        1. [340] スクリプトについてモジュールスクリプトの子孫をfetchして実現値化を実行します。
          終点
          script
          続きの処理
          >>316
  21. [361] >>360 の実行タイミングにより、
    要素を作成した構文解析器文書list of scripts that will execute when the document has finished parsing の末尾に要素を追加します。
    要素を作成した構文解析器文書pending parsing-blocking script を、要素に設定します。
    要素節点文書list of scripts that will execute in order as soon as possible の末尾に要素を追加します。
    要素節点文書set of scripts that will execute as soon as possible要素を追加します。
    要素を作成した構文解析器文書pending parsing-blocking script を、要素に設定します。

[316] スクリプトのfetch続きの処理は、 スクリプトについて次のようにしなければなりません >>130

  1. [317] 要素スクリプトのスクリプトを、スクリプトに設定します。
  2. [318] 要素スクリプトの準備完了とします (>>365)。

[320] スクリプトの準備は、次の動作から呼び出されることがあります。

[319] 利用者エージェントは、性能のため、 script 要素src 属性の設定が行われた時点で、スクリプトの準備によるスクリプトのfetchを行って構いません >>130。 (実行はまだ行わず、後に文書に挿入された時に (属性などの状況が変わっていなければ) fetch 結果を利用します。)

[326] 実装によっては更に早い段階 (preload scanner) で fetch が実行されています。

[264] スクリプトの準備の処理に関連して、 script 要素には次のような性質があります。

スクリプトの準備完了

[364] script 要素は、 スクリプトの準備の実行の過程で、 スクリプトの準備完了 (the script is ready) >>130 となります。

[248] script 要素スクリプトが準備完了するまで、 節点文書loadイベントを遅延しなければなりません >>130。 つまり構文解析器の動作中にスクリプトのfetchが開始されると、 それが (成功であれ失敗であれ) 完了するまでは load発火されません。

[367] 節点文書が変化した場合の扱いは不明です。

[365] 要素スクリプトの準備完了により、 次のようにしなければなりません >>130

  1. [366] >>360 の実行タイミングにより、
    甲、乙、戊
    1. [368] 要素「構文解析器実行準備完了」フラグを設定します。
    2. [475] >>453>>489スピンを終了できるかもしれません。
    1. [369] リストを、 >>361list of scripts that will execute in order as soon as possible に設定します。
    2. [373] リストの最初の要素要素の場合、
      1. [371] 要素準備完了フラグを設定します。
    3. [370] リストの最初の要素準備完了フラグが設定されている限り繰り返し、
      1. [372] リストの最初の要素についてスクリプトブロックを実行します。
      2. [374] リストから最初の要素を削除します。
    4. [497] stop parsing 内のスピン中なら、これを終了できるかもしれません。
    1. [375] 要素についてスクリプトブロックを実行します。
    2. [376] >>361set of scripts that will execute as soon as possible から要素を削除します。
    3. [498] stop parsing 内のスピン中なら、これを終了できるかもしれません。
    1. [378] 要素についてスクリプトブロックを実行します。

[377] >>361 とは通常は要素節点文書ですが、 処理がここに到着するまでの間に要素が他の文書adopt される可能性もあります。

実行タイミング

[164] script 要素から作成されたスクリプトの実行のタイミングは、 構文解析器によって作られた script 要素か否かや、属性の有無により、何種類かあります。

[170] >>169>>165>>166 は、構文解析器を呼び出したタスクの中で直接スクリプトが同期的に実行されます。 いずれにせよ構文解析器内部でスクリプトが実行されるのは、 HTML または SVGscript 終了タグ (または SVG script 空要素タグ) の処理中に限られます。

[171] >>167>>168 は、構文解析器とは別のタスクスクリプトが実行されます。

[172] タスクイベントループによって処理されるので、 >>171 の場合構文解析器スクリプトが同時に実行されることはありません。 また UIイベントsetTimeoutコールバックなどが構文解析器の動作期間中に実行されることもありますが、 やはり別のタスクとして処理されるので、構文解析器や他のスクリプトと同時に実行されることはありません。

[173] なお script 要素スクリプトは、 それ自体のコードの実行の他に、前後に各種イベントdispatchされたり、 エラーの報告が行われたりすることがあり、同期的に複数のスクリプトが同タスク内で実行されることがあります (が、やはり同時にではありません)

[174] script タグの処理前にはマイクロタスクチェックポイントがあり、 マイクロタスクがあればそのタイミングで、つまり構文解析器と同じタスクの内部で同期的に実行されます。

実行タイミングの決定

[360] 要素の実行タイミングの種別は、次の通り決定しなければなりません >>140。 甲乙丙丁戊己のいずれかに定まります。

  1. [342] 要素スクリプトの型classic の場合、
    1. [356] 要素src 属性を持つ場合、
      1. [352] 要素async 属性を持たない場合、
        1. [347] 要素「構文解析器挿入」フラグを持つ場合、
          1. [345] 要素defer 属性を持つ場合、
          2. [346] それ以外の場合、
        2. [348] それ以外で、要素「非ブロッキング」フラグを持たない場合、
        3. [351] それ以外の場合、
      2. [353] それ以外の場合、
    2. [357] それ以外の場合、
      1. [358]
        ... のすべてを満たす場合、
      2. [359] それ以外の場合、
  2. [343] 要素スクリプトの型module の場合、
    1. [354] 要素async 属性を持たない場合、
      1. [349] 要素「構文解析器挿入」フラグを持つ場合、
      2. [350] それ以外で、要素「非ブロッキング」フラグを持たない場合、
      3. [355] それ以外の場合、
    2. [344] それ以外の場合、
[362] 丙、丁は通常の script 要素としての実行、 それ以外は構文解析器による script 要素の実行です。

pending parsing-blocking script

[467] 文書pending parsing-blocking script >>130 は、script 要素か null のいずれかです。 初期状態では null です。

[468] これは、 <script src> で指定された外部スクリプト資源の読み込み待ち、 またはスタイルシートの読み込み待ち (has a style sheet that is blocking scripts) のためにスクリプトの実行および構文解析器の一切の動作が停止される時に使われます。

[469] スクリプトの準備スクリプトが実行されない場合に、 script 要素に設定されます (>>361)。 準備が整ってスクリプトが実行される時に、消去されます (>>450)。

[470] document.write, document.writeln, document.close では、 構文解析器の処理を実行するべきかどうかの判定に使われています。

[476] pending parsing-blocking script が設定されている時は、 (他のフラグの状態も含めて) 構文解析器の進行が完全に停止されていますから、 新たな script 要素構文解析器により挿入されることもなく、 従って別の要素pending parsing-blocking script となることもありません。

[466] script 終了タグの処理 (>>423) から呼び出される、 構文解析器pending parsing-blocking script の処理は、 次のようにしなければなりません >>422, >>424

  1. [444] 構文解析器文書pending parsing-blocking script がなければ、 ここで停止します。
  2. [445] 構文解析器スクリプト入れ子水準が0以外なら、
    1. [447] 構文解析器parser pause flagを、に設定します。
    2. [448] 構文解析器の (本処理を呼び出した木構築処理を呼び出した) 字句化を中断します。
    3. [471] ここで停止します。
  3. [449] スクリプトを、構文解析器文書pending parsing-blocking script に設定します。
  4. [450] 構文解析器文書pending parsing-blocking script を、 null に設定します。
  5. [451] 構文解析器について字句化器のブロックを実行します。
  6. [452] 構文解析器文書has a style sheet that is blocking scripts フラグが設定されているか、スクリプト「構文解析器実行準備完了」フラグが設定されていないなら、
    1. [453] 構文解析器文書イベントループについてイベントループをスピンします。 終了条件は、構文解析器文書has no style sheet that is blocking scripts となり、かつスクリプト「構文解析器実行準備完了」フラグが設定されることです。 続きの処理は、構文解析器スクリプトについて >>446 を実行することです。
  7. [472] それ以外なら、
    1. [473] 構文解析器スクリプトについて >>446 を実行します。

[446] 続きの処理は、構文解析器スクリプトについて次のようにしなければなりません >>422, >>424

  1. [454] 構文解析器abort済み (= abort a parser 済み) なら、 ここで停止します。
  2. [455] 構文解析器について字句化器のブロック解除を実行します。
  3. [456] 構文解析器挿入点を、構文解析器次入力文字の直前に設定します。
  4. [457] 構文解析器スクリプト入れ子水準インクリメントします。
  5. [458] スクリプトについてスクリプトブロックを実行します。
  6. [459] 構文解析器スクリプト入れ子水準デクリメントします。
  7. [460] 構文解析器スクリプト入れ子水準が0なら、
    1. [461] 構文解析器parser pause flagを、に設定します。
  8. [462] 構文解析器挿入点を、 null に設定します。
  9. [463] 構文解析器pending parsing-blocking script の処理 (>>466) を実行します。

[474] スクリプト入れ子水準の分岐 (>>445) より、 document.write の再帰的な構文解析器実行中に script 要素で処理が中断される場合には、 そこで document.write構文解析は中断されて、 document.write の呼び出し元スクリプトの続きの実行に移ります。 再帰的な構文解析器スクリプトがすべて終了して最外構文解析器にまで戻ってきた時に、 先送りしていた script 要素を (更に待つ必要があるなら待ってから) 実行することになります。

[478] この分岐は、戊と己の分岐に対応します。

list of scripts that will execute when the document has finished parsing

[483] 文書list of scripts that will execute when the document has finished parsing >>130 は、 script 要素のリストです。 初期状態では空です。

[485] これは defer 属性の動作を実現するためのものです。 (モジュールスクリプトの場合は標準動作が defer 属性相当なので、それも含まれます。)

[486] 甲のケースです。

[487] 構文解析器構文解析器の処理終了時に呼び出される stop parsing で、構文解析終了後のスクリプト実行の処理は、 続きの処理について次のようにしなければなりません >>482

  1. [488] 構文解析器文書list of scripts that will execute when the document has finished parsing が空なら、
    1. [492] 構文解析器について続きの処理を実行します。
    2. [491] ここで停止します。
  2. [493] スクリプトを、 構文解析器文書list of scripts that will execute when the document has finished parsing の最初の要素に設定します。
  3. [489] 構文解析器文書イベントループについてイベントループをスピンします。 終了条件は、構文解析器文書has no style sheet that is blocking scripts となり、かつスクリプト「構文解析器実行準備完了」フラグが設定されることです。 続きの処理は、構文解析器スクリプト続きの処理について >>490 を実行することです。

[490] 条件達成後、構文解析器スクリプト続きの処理について次のようにしなければなりません >>482

  1. [494] スクリプトについてスクリプトブロックを実行します。
  2. [495] スクリプト構文解析器文書list of scripts that will execute when the document has finished parsing から削除します。
  3. [496] 構文解析器続きの処理について、 構文解析終了後のスクリプト実行の処理 (>>487) を実行します。

実行

[379] 要素に関するスクリプトブロックの実行 (execute a script block) は、 次のようにしなければなりません >>130

  1. [380] 要素「構文解析器挿入」フラグが設定されている場合、
    1. [381] 要素節点文書要素を作成した構文解析器文書と異なる場合、
      1. [382] ここで停止します。
  2. [383] 要素スクリプトのスクリプトが null の場合、
    1. [390] 要素のエラーを通知 (>>391) します。
    2. [384] ここで停止します。
  3. [395] 要素外部ファイルからフラグが設定されているか、 要素スクリプトの型module なら、
    1. [397] neutralised doc を、要素節点文書に設定します。
    2. [396] neutralised docignore-destructive-writes counterインクリメントします。
  4. [398] 旧スクリプトを、要素節点文書currentScript に設定します。
  5. [315] 要素スクリプトの型classic で、 要素影根ないなら、
    1. [399] 要素節点文書currentScript を、要素に設定します。
  6. [392] それ以外なら、
    1. [393] 要素節点文書currentScript を、 null に設定します。
  7. [330] 要素スクリプトのスクリプト実行します。
  8. [402] 要素節点文書currentScript を、旧スクリプトに設定します。
  9. [406] 要素外部ファイルからフラグが設定されているか、 要素スクリプトの型module なら、
    1. [404] neutralised docignore-destructive-writes counterデクリメントします。
  10. [408] 要素外部ファイルからフラグが設定されていて、 要素スクリプトの型module なら、
    1. [407] 単純イベントを発火します。
      [400] 単純イベント
      イベント型
      load
      対象
      要素

[520] 従って、 currentScript は、 古典スクリプト実行時にのみ有効です。しかも影木中のスクリプトでは使えません。

エラーの通知

[410] スクリプトfetch に関するエラーは、 error イベントで通知されます。これは起源に関わらず詳しい情報が提供されません。

[305] 要素のエラーを通知するタスクを追加するとは、次のようにすることを言います。

  1. [306] タスクキュータスクを追加します >>130
    タスク
    処理
    要素のエラーを通知 (>>391) します。
    タスク源
    ?

[391] 要素のエラーを通知するとは、次のようにすることを言います >>130

  1. [307] 単純イベントを発火します。
    単純イベント
    イベント型
    error
    対象
    要素

[411] スクリプトの実行時エラーは、他のスクリプト同様に例外の報告により処理されます。 こちらは起源次第で報告内容が省略されることがあります。

HTMLScriptElement インターフェイス

[190] script 要素要素インターフェイスは、 HTMLScriptElement です >>130

[191] HTMLElement インターフェイス継承しつつ、 次のメンバーが定義されています。

[547] HTMLScriptElement インターフェイスメンバー

セキュリティー

[43] Web メイルにおける HTML メイル: HTML利用者界面として利用した MUA (いわゆる Webメイル) で HTML 文書が含まれるメイルメッセージを表示する時には特に注意が必要です。 script 要素などスクリプトが実行され得るものをそのまま HTML に含めると、 Webブラウザ側でその HTML 文書全体 (HTMLメイル自体とその周りの利用者界面を含む全体) の権限でスクリプトが実行されることになります。

Webブラウザ外に被害が及ぶかという点では通常の鯖側のスクリプトの安全上の脅威と変わりませんが、 利用者界面の部分を介して利用者の意図せぬ (削除などの) 操作を行ったり、受信したメッセージや個人情報が流出したりする危険性があります。

歴史

[2] script 要素は、 NN2LiveScript と共に実装したのがはじめであると考えられています。

[20] script 要素がはじめて公式な仕様書に入ったのは 1997年1月の HTML 3.2 でした。しかし、 このときの最終的な勧告では詳細が決まらず、 将来の版のために予約すると述べるに留まっていました。

<!ELEMENT SCRIPT - - CDATA -- placeholder for script statements --> HTML 3.2 DTD

HTML4

[12] その後1997年12月の HTML 4 で、 script 要素型はようやく正式な仕様の一部となりました。 当時 WinIENN が実装していた script の基本的な機能が仕様に入りましたが、 WinIE だけが実装していた event 属性と for 属性は、 将来のために予約とされました。

[24] 1998年に勧告された DOM 1 やその後の DOM 2 では、 script 要素型に対応する HTMLScriptElement 界面が定義されています。ここでは、標準の属性の他、 for 属性と event 属性も将来の使用のために予約 として定義だけされています。

[25] >>24 そんな将来くるのかな〜。来たら嫌だな〜

[26] >>24-25 将来の使用は M$ の仕様の間違いじゃないのかな。

[32] >>24-26 その後 XHTML 1 が標準化されましたが、予約2属性はやはり正式な仕様には昇格せず、 このまま忘れ去られようとしています。しかし、両属性の機能は拡張して汎用化されて XML事象仕様の一部として標準化されました (2002年)。

[4] src 属性が指定されている場合、 スクリプトはその外部資源で定義されます。 UA内容を無視し、指定された URI のスクリプトを取り寄せなければなりません。 src 属性が指定されていない場合、 UA は内容をスクリプトとして解釈しなければなりません。 HTML 4 18.2.1

[30] XHTML より前の HTML では、 script 要素の内容は style 要素の内容同様文字データ (CDATA) 宣言内容とされていました。 つまり、 script 要素内ではほとんどのマークは認知されず、 etago (</) の 直後に名前開始文字 (ラテン文字など) または tagc (>) が来たらそこで script 要素が終わることになっていました。

ですから、スクリプト言語の演算子などとして HTMLマーク文字が登場することがよくありますが、 そのような場合にもほとんど文字参照化する必要がありませんでした。

[36] ETAGO がかけないのは document.write のデータを作る時などにしばしば問題となり、その最盛期には、 これが原因でうまく動かないことに悩む人もよく見受けられました。 回避するためには、そのスクリプト言語の文字列連結を使ったり ('<' + '/a>')、 escape (quote) 機能を使ったり ('<\/a>')、文字生成関数を使ったり ("<" & Chr (47) & "a>") する方法がよく紹介されました。

[33] しかし、 XML では CDATA 宣言内容は使えないので、 XHTML 1 では PCDATA と宣言されています。 ですから、 STAGO (<) は必ず escape して &lt; としなければならないなどの制限があります。 これを回避するために CDATA区間を使う方法がよく紹介されますが、 そうすると多くの既存の WWW ブラウザとの互換性が失われてしまいます。 ですから、 XHTMLscript 要素を使う時は src 属性を使った外部スクリプトとするのが良いと言われています。

[41] src で指定された資源が取得できない時に内容を使うとする説があります。

SCRIPT - Client-side Script(jp) http://www.htmlhelp.com/ja/reference/html40/special/script.html

しかし、 HTML 4 の規定と矛盾します。 (この文書はほんとうに HTML 4 に基づいているのでしょうか?)

[47] Working with the WebKit Nightly Builds http://developer.apple.com/opensource/internet/nightlywebkit.html (名無しさん 2006-11-05 02:47:22 +00:00)

[48] Surfin’ Safari - Blog Archive &#187; Understanding HTML, XML and XHTML http://webkit.org/blog/?p=68

[37] 二乗した結果を書き出す例 HTML 4 18.3.2 改

JavaScript による例

<SCRIPT type="text/javascript">
<!--  to hide script contents from old browsers
  function square(i) {
    document.write("The call passed ", i ," to the function.","<BR>");
    return i * i;
  }
  document.write("The function returned ",square(5),".");
// end hiding contents from old browsers  -->
</SCRIPT>

VBScript による例

<SCRIPT type="text/vbscript">
<!--
  Function Square(i)
    Call Document.Write("The call passed ",i," to the function.","<BR>")
    Square = i * i
  End Function
  Document.Write("The function returned ",Square(5),".")
' -->
</SCRIPT>

Tcl による例

<SCRIPT type="text/tcl">
<!--  to hide script contents from old browsers
  proc square {i} {
    document write "The call passed $i to the function.<BR>"
    return [expr $i * $i]
  }
  document write "The function returned [square 5]."
# end hiding contents from old browsers  -->
</SCRIPT>

[28] script 要素によるスクリプトは、 文書の読込み時に実行されます HTML 4 18.1

[256] src 属性による外部スクリプトは優先的に実行されるという説を唱える人がいますが、 根拠は不明です。特定の UA ではそうなのかもしれませんが、 少なくても HTML 4 は何も規定していません。 但し、 defer 属性や event 属性は実行時機に影響するのかもしれません。

実装

[31] CGI.pm は、 XHTML 出力 mode だと、 注釈宣言内に CDATA区間宣言という素晴らしい出力をしてくれます(w

[50] Bug 60724 &#8211; <script> tag inside <applet> tag executes if Java enabled (2007-02-10 13:51:33 +09:00 版) https://bugzilla.mozilla.org/show_bug.cgi?id=60724 (名無しさん)

不思議解釈

[34] src 属性のある script の中に noscript を書く困った人がいます。。。

(名無しさん 2004-09-14 07:54:57 +00:00)

[17] 仕様によれば (>>4)、 src 属性があるとき UA は内容を無視しなければなりません。この規定に特に条件は無いようなので、 スクリプト未対応の UA であっても同様でしょう。 ですから、 script の中に noscript を書くと、 HTML 4 対応の script 未対応 UA には無視されてしまうはずです。

[15] しかし、不思議マーク付けの世界や多くの WWWブラウザの実装では、 html タグの前後や head 要素と body 要素の間を含めて、あらゆる場所に出現できるようです。

ダイナミックHTML入門 (Bruce Campbell + Rick Darnell 著, 安藤慶一訳) という入門書では、 スクリプトの場所に関しては標準規格は必要ないようです などと電波を飛ばしているそうです。 いくつかの書籍のあらさがし http://openlab.ring.gr.jp/k16/htmllint/findfault.html#dynamic-html

他との関係

[3] ASP などの鯖側で HTML 文書 (もどき) を前処理する類のシステムの一部では、 script 要素 (のようなもの) を拡張して、 runat 属性などを付与して鯖側で実行するものと script 要素としてクライアントに送信するものを区別していることがあります。

(そのような実現方法は開発者がスクリプトの実行を正しく把握しづらくなるのではないかとの懸念はあります。 その点、 NES のように server 要素型という別の要素型を用意するのは一つの考えではありますが、 どんぐりのせいくらべといったところでしょう。)

[13] スクリプトによって HTML 文書を動的に扱う方法として、 JavaScriptdocument.write がよく使われました。 (document.write は後に DOM 1HTMLDocument 界面の write method として標準化されています。)

HTML 4 仕様書は読み込み時のスクリプトによる文書に書き換えについても規定していますが、 その内容は document.write (と同様なもの) を想定しているようです。実際に使われていたのも document.write (と同様なもの) だけでしょう。というわけで、 write method の説明もご覧ください。

[39] スクリプトに対応していなかったり、実行しないことにしていたりするときの代替内容を提供する noscript が用意されています。アクセス可能性の確保のために、 重要な情報を提供する script は、 対応する noscript 要素を用意しておくことが極めて望ましいと考えられます。

[45] XML事象の仕様書には事象取扱器として script を使う例があり、 Opera 9 でも script事象取扱器にできるように実装されています。

が、 XML事象属性がある script 要素も、 文書読込み時には属性がないときと同じように実行されてしまうので、 あまり使いやすくありません。

XHTML2

[73] XHTML2 第6次案までは script 要素がありましたが、 第7次案で handler に改名されました。

メモ

[44] XHTML Frequently Answered Questions http://www.w3.org/MarkUp/2004/xhtml-faq#docwrite

HTML 4SGML 応用なのに document.write が使えて、 XHTML 1XML 応用だから document.write が使えないというのはよくわからない。 (名無しさん 2006-08-05 06:53:16 +00:00)

[46] 404 Blog Not Found:javascript - scriptタグによる通信が特許侵害!? http://blog.livedoor.jp/dankogai/archives/50677817.html (名無しさん 2006-11-04 02:20:29 +00:00)

script 要素 (ASP)

HTML (>>9) に加えて、
runatserverなし動作場所 >>5

[5] runat は、 M$ASP で使われて、値が "server" である場合に、その要素のスクリプトはサーバーで処理されます。 (クライアントには送られません。) この属性は W3C の規格では規定されていません。サーバーで処理される以外で使ってはいけません。

  • [6] >>2-3,>>5 language 属性や type 属性を省略しても <%@ Page Language="VB" %> みたいのが書いてあれば、それ以降の部分で解釈されるサーバー側スクリプトはその言語で解釈されるそうです。
  • [7] >>5-6 それから、 runat 属性はどんな要素にも? 使えて、サーバー側スクリプトからアクセス可能なことを表す?らしいです。全くもって理解不能な世界ですが。。。
  • [8] >>2 ASP での既定値は (設定ファイルで変更しない限り) VB (= VBScript) だそうです。

script 要素型 (CSP)

msxsl:script 要素 (M$XML の XSLT 実装)

[21] {urn:schemas-microsoft-com:xslt}:script 要素を使うと、 XSLT (の XPath を使う文脈) で利用者定義の関数を使用することが可能となります。

親要素は xslt:stylesheet 要素又は xslt:transform 要素です。内容は #PCDATA です (たぶん)。

implements-prefix名前空間接頭辞必須関数の名前空間
languagehtml:language と同じ不明スクリプト言語

language 属性には html:script 要素の場合と同じ値を指定できるそうです。 implements-prefix 属性には、 XSLT 側で関数を呼ぶ際の XML名前空間接頭辞を与えます。 この値は自分以上の要素の xmlns 属性を使って宣言されていなければならないはずです。

[22] 言葉で説明するより実例を見たほうが分かりやすいでしょう。

  xslt:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:msxsl="urn:schemas-microsoft-com:xslt"
        xmlns:foo="http://foo.example/">
    msxsl:script language="JScript" implements-prefix="foo"
      function bar (baz) {
        return baz;
      }
    </msxsl:script>
    xslt:template select="element1"
      xslt:apply-templates select="foo:bar(element2)"/
    </xslt:template>
  </xslt:stylesheet>

この場合は関数 foo:bar(baz) は引数 baz をただ返すだけの何の面白味もないものですが、 雰囲気はつかめるでしょう。

xalan:script 要素 (Xalan-Java XSLT 実装)

[23] Xalan では XSLT スタイル・シートJavaScript などを使うのに xalan:script 要素を使います。

親要素は xalan:component 要素です。

langCDATA必須スクリプト言語
srcURI(指定なし)外部スクリプト参照

HTML や MSXML での書き方と互換性はありません。

void 要素化された script 要素の実装

[69] PrestoWebKitscript 開始タグ認められている斜線を認識し、 void要素と同じような挙動をします。この挙動は既存の Widget (Opera WidgetDashboard) との互換性のために必要です。

[70] Ian Hickson は、特定の非 Web 環境で必要という理由だけで HTML5 仕様を変更するつもりはないと >>68 で述べています。 (かなり前にもこの問題が取り上げられたときに同じことを言っていた気がします。)

HTML5

[323] HTML5 では、初めてスクリプトの処理モデルが規定されました。

[324] データブロックとしての利用法も HTML5 で追加されました。

[49] Bug 178258 &#8211; document.forms has no properties on a page without <body> (JavaScript error) (2007-01-29 17:04:28 +09:00 版) https://bugzilla.mozilla.org/show_bug.cgi?id=178258

[79] 図にしましたwwww script要素の内容の制約の図

[51] HTML5 script start tag should select appropriate content model according to src (David Woolley 著, 2007-04-21 22:52:46 +09:00 版) http://lists.w3.org/Archives/Public/www-html/2007Apr/0053.html (名無しさん 2007-04-28 03:58:40 +00:00)

[52] HTML5 IRC logs: w3c / #html-wg / 20070423 (2007-06-30 15:38:51 +09:00 版) http://krijnhoetmer.nl/irc-logs/html-wg/20070423#l-144

[03:47] <mjs> Lachy: since you were discussing Safari's handling of <script /> earlier, we might make that a Dashboard-only quirk - we foolishly did it for Firefox compatibility, and then a huge number of Dashboard widgets started relying on it, and now Firefox no longer handles it as empty in HTML

(名無しさん)

[53] http charset, <script> and IE (tex 著, 2007-07-30 06:33:36 +09:00 版) http://lists.w3.org/Archives/Public/www-international/2007JulSep/0040.html (名無しさん)

[54] “消えた初音ミク”問題 ヤフーとGoogle「原因を調査中」 - ITmedia News (2007-10-18 22:03:18 +09:00 版) http://www.itmedia.co.jp/news/articles/0710/18/news065.html

<script language="JavaScript" type="text/javascript">
<!--
var pid="784200073";
var locs="ITOT1";
var random=new Date();
var js_url='http://dlv.itmedia.co.jp/adsv/v1?posall='+locs+'&id='+pid+'&rnd='+random.getTime();
document.write('<sc'+'ript language="JavaScript" type="text/javascript" src="'+js_url+'">');
document.write('</sc'+'ript>');
//-->
</script>

[55] Re: <script> for non-script content (Ian Hickson 著, 2008-05-14 16:53:44 +09:00 版) http://lists.w3.org/Archives/Public/public-html/2008May/0291.html (名無しさん)

[56] 冬様もすなる☆日記というもの (2008年7月) (わかば 著, 2008-07-21 17:28:49 +09:00 版) http://suika.fam.cx/~wakaba/d/d200807#d21-1 (名無しさん)

[57] Kanasan.JS JavaScript 第 5 版読書会 #5: Days on the Moon (2008-07-26 22:46:16 +09:00 版) http://nanto.asablo.jp/blog/2008/07/25/3648120 (名無しさん)

[58] OpenSocial Data Pipelining - OpenSocial Specifications (2008-09-04 06:00:40 +09:00 版) http://wiki.opensocial-templates.org/index.php?title=OpenSocial_Data_Pipelining (名無しさん)

[60] High Performance Web Sites :: “Delayed Script Execution” in Opera (2008-09-17 13:31:22 +09:00 版) http://www.stevesouders.com/blog/2008/09/11/delayed-script-execution-in-opera/

[62] John Resig - JavaScript Micro-Templating ( 版) http://ejohn.org/blog/javascript-micro-templating/

[63] deferasync なしの場合で、 src ありの場合に、外部スクリプトが実行されるまで構文解析は停止するか?

Index of /~wakaba/-temp/test/html/script/src ( 版) http://suika.fam.cx/~wakaba/-temp/test/html/script/src/

[64] HTML として記述された script 要素の場合 (nodefer-1)、 どのブラウザも構文解析が停止します。

[65] DOM によって作成された script 要素の場合 (nodefer-script-1)、 Opera 以外は構文解析を続行し、外部スクリプトは準備が出来次第実行します (HTML5 に従った動作)。 Opera 9.61 は >>64 同様、構文解析を停止します。

[59] OSML側で処理される HTML 片の script 要素 (type="text/os-data"type="text/os-template]}" には、 beforeDatarequireData のような属性を更に指定できます。 (名無しさん)

[61] Bug 304786 &#8211; dynamically inserting/adding xul:script via DOM doesn't work ( 版) https://bugzilla.mozilla.org/show_bug.cgi?id=304786

[66] [JavaScript] とてもシンプルに自分自身が属する script 要素を取得 - IT戦記 ( 版) http://d.hatena.ne.jp/amachang/20061201/1164986067

[67] Scripting – SVG Tiny 1.2 ( 版) http://www.w3.org/TR/2008/REC-SVGTiny12-20081222/script.html#ScriptElement

[71] Index of /script-execution ( 版) http://testsuites.opera.com/script-execution/

[72] SVGを直接HTMLに埋め込む方法(プラグインを使わない) - dhrnameの開発日誌 ( 版) http://d.hatena.ne.jp/dhrname/20080105/1199534939

[74] Re: [HTML5] DOMContentLoaded fires before CSS resources loaded? (Ian Hickson 著, 版) http://lists.w3.org/Archives/Public/public-html/2009Aug/0064.html

[75] (X)HTML5 Tracking ( 版) http://html5.org/tools/web-apps-tracker?from=4102&to=4103

[76] (X)HTML5 Tracking ( 版) http://html5.org/tools/web-apps-tracker?from=4177&to=4178

[77] (X)HTML5 Tracking ( 版) http://html5.org/tools/web-apps-tracker?from=4178&to=4179

[78] IRC logs: freenode / #whatwg / 20091026 ( 版) http://krijnhoetmer.nl/irc-logs/whatwg/20091026#l-421

[80] Forum Nokia - Driving innovation for mobile application developers ( 版) http://www.forum.nokia.com/

[81] HTML5 Revision Tracker ( 版) http://html5.org/tools/web-apps-tracker?from=5156&to=5157

[82] [whatwg] The choice of script global object to use when the script element is moved ( 版) http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2010-September/028457.html

[83] Web Applications 1.0 r5449 Make the 'already started' flag actually work. Also, reorder things in the 'run' algorithm so that we check things in order of cost to check, instead of doing the work up front and then the checks afterwards.Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=10240 ( ( 版)) http://html5.org/tools/web-apps-tracker?from=5448&to=5449

[84] Web Applications 1.0 r5496 Allow parser-inserted scripts to rerun if they failed to be run by the parser.Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=10519 ( ( 版)) http://html5.org/tools/web-apps-tracker?from=5495&to=5496

[85] Web Applications 1.0 r5499 Make policy checks for <script> happen after the flag is set that prevents the script from being run again, so that if somehow an attacker causes a document to be reinserted somewhere that has scripts enabled, the scripts still won't run.Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=10523 ( ( 版)) http://html5.org/tools/web-apps-tracker?from=5498&to=5499

[86] Web Applications 1.0 r5545 Match Gecko for character encoding processing for <script>Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=10656 ( ( 版)) http://html5.org/tools/web-apps-tracker?from=5544&to=5545

[87] Web Applications 1.0 r5597 add a note about script executionFixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=10539 ( ( 版)) http://html5.org/tools/web-apps-tracker?from=5596&to=5597

[88] Web Applications 1.0 r5663 Make style sheets block scripts even in descendant documentsFixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=10575 ( ( 版)) http://html5.org/tools/web-apps-tracker?from=5662&to=5663

[89] Using Inline XAML ( ( 版)) http://msdn.microsoft.com/en-us/library/cc189016%28v=vs.95%29.aspx

[90] Data Binding - Ample SDK ( ( 版)) http://www.amplesdk.com/examples/core/aml/databinding/

[91] [whatwg] Re: rel="script" ( ( 版)) http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2005-July/004503.html

[92] [whatwg] The choice of script global object to use when the script element is moved ( ( 版)) http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2011-February/030170.html

[93] Web Applications 1.0 r5817 Make script-inserted external scripts that have .async=false execute in the insertion order, default to true ( ( 版)) http://html5.org/tools/web-apps-tracker?from=5816&to=5817

[94] Hixie's Natural Log: Script execution order post-mortem ( ( 版)) http://ln.hixie.ch/?start=1296711456&count=1

[95] Web Applications 1.0 r5883 Make a parser-inserted script not run if it is moved to another document before it executes (and not even fetch if it is parsed into another document than its parser's document). ( ( 版)) http://html5.org/tools/web-apps-tracker?from=5882&to=5883

[96] Web Applications 1.0 r5891 Continue the conformance chain for inline <script> elements. Somehow I'd missed that case. ( ( 版)) http://html5.org/tools/web-apps-tracker?from=5890&to=5891

[97] Web Applications 1.0 r5905 Make sure that all synchronous sections run before <script> elements, so that a <script> following a <video> has a state that doesn't depend on whether the browser splits up its parser tasks. ( ( 版)) http://html5.org/tools/web-apps-tracker?from=5904&to=5905

[98] IRC logs: freenode / #whatwg / 20110203 ( ( 版)) http://krijnhoetmer.nl/irc-logs/whatwg/20110203

[99] Web Applications 1.0 r6049 Try to warn implementors about XSLT. ( ( 版)) http://html5.org/tools/web-apps-tracker?from=6048&to=6049

[100] [whatwg] Proposal for separating script downloads and execution ( ( 版)) http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2011-May/031768.html

[101] IRC logs: freenode / #whatwg / 20110529 ( ( 版)) http://krijnhoetmer.nl/irc-logs/whatwg/20110529

[102] [whatwg] Should script run if it comes from a HTML fragment? ( 版) http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2011-June/031941.html

[103] Voice Browser Call Control: CCXML Version 1.0 ( ( 版)) http://www.w3.org/TR/2011/REC-ccxml-20110705/#Script

[104] [whatwg] Feedback regarding script execution ( ( 版)) http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2011-September/033132.html

[105] Web Applications 1.0 r4103 Define how <script> gets blocked while <style>@import</style>, and a general rewrite of how <script>s are executed and interact with the parsers. ( 版) http://html5.org/tools/web-apps-tracker?from=4102&to=4103

[106] IE7IE8 も、文書中にない要素scriptappendChild しただけで実行してしまいます。 これはひどい・・・・。

[107] [whatwg] <script> features ( ( 版)) http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2012-February/034629.html

[108] IRC logs: freenode / #whatwg / 20120206 ( ( 版)) http://krijnhoetmer.nl/irc-logs/whatwg/20120206

[109] IRC logs: freenode / #whatwg / 20120427 ( ( 版)) http://krijnhoetmer.nl/irc-logs/whatwg/20120427#l-514

[110] [whatwg] script-related feedback ( ( 版)) http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2012-May/035713.html

[111] IRC logs: freenode / #whatwg / 20120620 ( ( 版)) http://krijnhoetmer.nl/irc-logs/whatwg/20120620#l-620

[112] IRC logs: freenode / #whatwg / 20120621 ( ( 版)) http://krijnhoetmer.nl/irc-logs/whatwg/20120621

[113] Web Applications 1.0 r7239 Make <script/> in SVG in text/html execute. ( ( 版)) http://html5.org/tools/web-apps-tracker?from=7238&to=7239

[114] XMLのWebAPIを爆速で使いこなせるフレームワーク - Yahoo! JAPAN Tech Blog ( ( 版)) http://techblog.yahoo.co.jp/programming/bakusoku-yql/

[115] Web Applications 1.0 r7420 Make the parser match the implementations (and not be more even more crazy than necessary). ( ( 版)) http://html5.org/tools/web-apps-tracker?from=7419&to=7420

[116] [whatwg] Proposal: Loading and executing script as quickly as possible using multipart/mixed ( ( 版)) http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2012-December/038223.html

[117] [whatwg] Script-related feedback ( ( 版)) http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2012-December/038429.html

[118] XBL 2.0 ( ( 版)) http://dev.w3.org/2006/xbl2/Overview.html#script-blocks

[119] Web Applications 1.0 r8022 Make <script> be accepted in most places <template> is now accepted, e.g. inside <table>s. Doesn't affect parsing. ( ( 版)) http://html5.org/tools/web-apps-tracker?from=8021&to=8022

[120] [whatwg] Script preloading ( ( 版)) http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2013-July/039960.html

[121] IRC logs: freenode / #whatwg / 20130709 ( ( 版)) http://krijnhoetmer.nl/irc-logs/whatwg/20130709

[122] Web Applications 1.0 r8124 Rejigger how scripts are described. Work in progress. ( ( 版)) http://html5.org/tools/web-apps-tracker?from=8123&to=8124

[123] Web Applications 1.0 r2529 MAJOR CHANGES: Revamp the way scripts are specified, along with their interaction with resolving relative URLs, etc. Give enough detail to justify objects in the DOM not being garbage collected randomly when still in use. Define script groups, to handle scripts going away during document.open() and session history navigation. Define why and how setTimeout(), database transactions, etc, handle page transitions. Drop the terms 'with' and 'without' script, use script is 'enabled'/'disabled' instead. Define 'unload' and 'beforeunload'. Rework how onfoo= and .onfoo event handler attributes are defined. Rework how the content model of <noscript> is defined. Reword the way javascript: is defined to use the new terminology. Add a few notes of things that came up while I was doing all that.]] ( ( 版)) http://html5.org/tools/web-apps-tracker?from=2528&to=2529

[124] IRC logs: freenode / #whatwg / 20130817 ( ( 版)) http://krijnhoetmer.nl/irc-logs/whatwg/20130817

[125] Web Applications 1.0 r8247 The bulk of this is editorial: refactoring how scripts are defined so that all the common stuff is in a shared 'settings object' rather than being duplicated per script. But this also cleans up how postMessage() interacts with the event loop and a few other things I've since forgotten. ( ( 版)) http://html5.org/tools/web-apps-tracker?from=8246&to=8247

[126] テンプレートエンジンでJavaScriptを動的生成する際のアンチパターン - 金利0無利息キャッシング – キャッシングできます - subtech ( ( 版)) http://subtech.g.hatena.ne.jp/mala/20131108/1383887454

[127] Web Applications 1.0 r8299 Remove the parts of the script content model that could lead to unbalanced crazy ( ( 版)) http://html5.org/tools/web-apps-tracker?from=8298&to=8299

[128] Web Applications 1.0 r8313 Another attempt at redefining <script> content rules to make zcorpan happy ( ( 版)) http://html5.org/tools/web-apps-tracker?from=8312&to=8313

[129] Web Applications 1.0 r8313 Another attempt at redefining <script> content rules to make zcorpan happy ( ( 版)) http://html5.org/tools/web-apps-tracker?from=8312&to=8313

[158] XML Binding Language (XBL) 2.0 ( ( 版)) http://www.w3.org/TR/2007/CR-xbl-20070316/#the-script

[159] Issue 329531 - chromium - Speculative parser fetches <script src> with unsupported type="" - An open-source project to help move the web forward. - Google Project Hosting ( ( 版)) https://code.google.com/p/chromium/issues/detail?id=329531

[160] SVG2 Requirements Input - SVG ( ( 版)) http://www.w3.org/Graphics/SVG/WG/wiki/SVG2_Requirements_Input#Consider_allowing_async.2Fdefer_on_.3Csvg%3Ascript.3E

[161] XML Binding Language (XBL) 2.0 ( ( 版)) http://www.w3.org/TR/2007/CR-xbl-20070316/#loading0

[162] IRC logs: freenode / #whatwg / 20140604 ( ( 版)) http://krijnhoetmer.nl/irc-logs/whatwg/20140604

[163] The "initialization" steps for Web browsers ( ( 版)) https://mail.mozilla.org/pipermail/es-discuss/2014-June/037544.html

[175] IRC logs: freenode / #whatwg / 20140721 ( ( 版)) http://krijnhoetmer.nl/irc-logs/whatwg/20140721

[176] XML Events 2 ( ( 版)) http://www.w3.org/TR/xml-events2/#s_script_module

[177] Java SE 7 Supported Locales ( 版) http://www.oracle.com/technetwork/java/javase/javase7locales-334809.html

<script id="ssInfo" type="text/xml" warning="DO NOT MODIFY!">

<ssinfo >

<fragmentinstance id="fragment14" fragmentid="Universal_Localization_Fragment" library="server:UNIVERSAL_LOCALIZATION_FRAG">

</fragmentinstance>

...

<fragmentinstance id="fragment44" fragmentid="ocom-commonassets" library="server:OCOM-FRAGMENT-LIBRARAY">

</fragmentinstance>

</ssinfo>

</script>

[178] Add async/defer script loading diagram · whatwg/html@940b7f7 ( 版) https://github.com/whatwg/html/commit/940b7f70d002e01685f913e2fc9350c5208e5927

[179] RDF in HTML: Approaches ( 版) http://infomesh.net/2002/rdfinhtml/

On the other hand, we have the script element with which to wrap some embedded XML RDF.

[279] HTML StandardFirefox は、構文解析器が作成した script節点文書が他の文書となっている場合、 スクリプトを実行しません。

[280] IE9IE11 は、構文解析器が作成した script が他の文書adopt されたら、以後スクリプトを実行しません。

[281] Chrome は、他の文書adopt されても気にせずにスクリプトを実行します。

2016年改訂

[325] 2015年末から2016年にかけた HTML Standard の一連の改訂では、 JavaScript 以外のスクリプト言語に関する規定が削除されると共に、 新たにモジュールスクリプトが導入されました。 その他細部の明確化が行われています。

[180] Call out to CSP's inline element hooks · whatwg/html@ee3486e ( 版) https://github.com/whatwg/html/commit/ee3486eb129bc350b5ca684d0c91dff23453ac1a

[181] Report 'inline' when inline violations occur. · w3c/webappsec-csp@eeb5227 ( 版) https://github.com/w3c/webappsec-csp/commit/eeb5227a76dab059002778e95575aed16ca4c2c4

[182] Close #384: add CSP hooks to handle inline events and style · whatwg/html@920c918 ( 版) https://github.com/whatwg/html/commit/920c9183a7990968ecac1aeedae22391f3438791

[184] Rewrite script execution on top of ES · whatwg/html@4891d18 ( 版) https://github.com/whatwg/html/commit/4891d18aaf2df1d40aa61f467a5a10cfc19dd85d

[185] Add <script type="module"> and module resolution/fetching/evaluation · whatwg/html@cd1a9fb ( 版) https://github.com/whatwg/html/commit/cd1a9fb1e83f7d0bc30be8b34ecdaf444a0b19a4

[217] Make script fetching more correct with regard to request destinations · whatwg/html@6dc9c9e ( 版) https://github.com/whatwg/html/commit/6dc9c9e1efcc3122294fb015e4a4eea66456a611

[513] Mitigate dangling markup attacks on nonces. · w3c/webappsec-csp@2c92a09 ( 版) https://github.com/w3c/webappsec-csp/commit/2c92a09beeede27e45f2acef4041aa0a1770fa99

[514] 23509 – Media-specific scripts (<script media="">?) ( 版) https://www.w3.org/Bugs/Public/show_bug.cgi?id=23509

[515] Allow currentScript to return SVGScriptElement · whatwg/html@6762f87 ( 版) https://github.com/whatwg/html/commit/6762f878f3080d5c188c3d8a0fcf6ee9ad8b2df4

[518] Pass cryptographic nonce metadata to Fetch · whatwg/html@5479e07 ( 版) https://github.com/whatwg/html/commit/5479e07a6f6e01062b85b5fe6799752b0370336c

[312] Don't update document.currentScript for module scripts · whatwg/html@6918282 ( 版) https://github.com/whatwg/html/commit/69182823e3dae507380fa9a70d26fe7b51ae62ac

[521] Pass parser metadata to Fetch · whatwg/html@e6500b9 ( 版) https://github.com/whatwg/html/commit/e6500b90244376c023e7b78642dbc7b86829233f

[524] Remove beforescriptexecute/afterscriptexecute events · whatwg/html@1a0b5e8 ( 版) https://github.com/whatwg/html/commit/1a0b5e8377d59462e05a5cffda4b8592324a2785

[314] Execute <script> in shadow trees · whatwg/html@caf203f ( 版) https://github.com/whatwg/html/commit/caf203fd4d9a5047d1ff2edad2290d53e21368ba

[394] currentScript needs to point to removed script elements ( (annevk著, )) https://github.com/whatwg/html/commit/3dc763829ca1598427b588cf08830c1e2af5a05c

[405] ( ()) http://www.marsflag.com/

<script type="text/javascript" src="/js/ext/sug.js#sv=http://s.marsfinder.jp/mf__ja__ja"></script>

<script type="text/javascript" src="/js/ext/muv.js#sv=http://s.marsfinder.jp/mf__ja__ja"></script>

<script src="/js/ext/tr.js#sv=http://s.marsfinder.jp/mf__ja__ja&hint=2RSeBTMNkEJRiac4rL6RFEbZcnex7Y7-zCgBR02DiWE." type="text/javascript" charset="UTF-8"></script>

[525] ( ()) http://www.mitsubishielectric.co.jp/fa/

<script src="http://search.mitsubishielectric.co.jp/mar/site/js/suggest_ext.js#unitid=fa_all" type="text/javascript" charset="UTF-8"></script>

[526] ( ()) http://www2.panasonic.biz/es/ai/products/search/detail?dep=&c=search&item_no=WK2103&item_cd=WK2103&bh_cd=3&b_cd=301&style=WK2103

<script src="http://panasonic.co.jp/common/mf/js/suggest_ext.js#unitid=ja_all" type="text/javascript" charset="UTF-8"></script>

[527] ( ()) http://www.kokuyo.co.jp/

<div class="search-box"><script src="http://search.kokuyo.co.jp/site/js/suggest_ext.js#unitid=ja_all" type="text/javascript" charset="UTF-8"></script>

[528] ( ()) http://www.kokuyo.co.jp/

<div class="search-box"><script src="http://search.kokuyo.co.jp/site/js/suggest_ext.js#unitid=ja_all" type="text/javascript" charset="UTF-8"></script>

[529] 埋め込み投稿 - ソーシャルプラグイン ( ()) https://developers.facebook.com/docs/plugins/embedded-posts/

js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&amp;version=v2.2";

[530] ( ()) http://dream.jp/

js.src = "//connect.facebook.net/ja_JP/all.js#xfbml=1&appId=192054277515151";

[531] 高井たかし(民進党)公式サイト | 維新の党代表選挙一人一票実現に向けて(2015年6月22日〜の週) ( ()) http://www.takaitakashi.com/%e6%b4%bb%e5%8b%95%e5%a0%b1%e5%91%8a/4817

js.src = "//connect.facebook.net/ja_JP/sdk.js#xfbml=1&version=v2.4&appId=1422917708013651";

[532] Clarify script encoding fallback ( (Resseguie著, )) https://github.com/whatwg/html/commit/ffbf252f5b1c9793fd59de9e64045ddebfabf982

[533] Align with vocabulary changes in the DOM Standard (annevk著, ) https://github.com/whatwg/html/commit/5b9c5d5a39c38b08e5a5c9334e14804f063235b2

[536] Improve all the script-fetching algorithms (domenic著, ) https://github.com/whatwg/html/commit/b4f40e72fcca8a13eefa8a2dd06258378e76fcb7

[537] DoodlePage Page.11 (jp) () http://userweb.alles.or.jp/sfujita/jpn/doodle11.htm#2002-0616

[2002-06-16] 最近目に付く奇妙なHTMLの注釈記述

近、多くのページで以下のような奇妙な注釈の使い方が目に付きます。

<!--//--><script>~スクリプト処理行 なんたらかんたら~</script>

プロバイダに依存せず、全く同一のコードが、全く同じ位置関係で記されている事から、何かのWebページ作成ツールあるいは、ある種のサーバーが出力していると思われますが、それを設計した人は意味を理解せずに作ったんでしょうかねぇ。

[538] Handle error cases during module script tree fetching/running better (domenic著, ) https://github.com/whatwg/html/commit/e1af86747f591e33fd0f3f21f301dc866868c9d4

[539] Mitigate nonce-stealing attacks. (mikewest著, ) https://github.com/w3c/webappsec-csp/commit/fe15bbb0f318b05a90978bd22c9814cb7820bef9

[540] Make document.write etc. throw during parsing custom elements (domenic著, ) https://github.com/whatwg/html/commit/00c6fa07bdb9f0d08a28f6c6e1ababca7d08618c

[541] Fix some callers of "create a module script" (domenic著, ) https://github.com/whatwg/html/commit/73af7511ab638a4fcb7a1db908ea746ad808344a

[542] Fix some callers of "create a module script" (domenic著, ) https://github.com/whatwg/html/commit/73af7511ab638a4fcb7a1db908ea746ad808344a

[545] Do not fire load events for inline scripts (domenic著, ) https://github.com/whatwg/html/commit/1bb62172079f4a30d74dcc7d0d1bf049a69daa22

[549] Don't queue a redundant task to fire module script load events (domenic著, ) https://github.com/whatwg/html/commit/b047cebdbe978df3ec36d4ee08f4c0f024b69b3f

[401] [giowt] (3) PARSER: Only run the SVG script execution logic if a <scr… (Hixie著, ) https://github.com/whatwg/html/commit/7ae642f94e0c262d1f816b73f3fa23de8867d595

[403] Upstream SRI's 'integrity' attribute (mikewest著, ) https://github.com/whatwg/html/commit/4c5066c171610e0c8300a58baf4f94816044cedc

[409] Disallow the integrity attribute for inline scripts (zcorpan著, ) https://github.com/whatwg/html/commit/7a405842a176c30a5d46c3520a1c8827b5483961

[546] 24892 – Specify speculative parsing and that it fetches bogus scripts. See https://code.google.com/p/chromium/issues/detail?id=329531 () https://www.w3.org/Bugs/Public/show_bug.cgi?id=24892

[552] (Re)disallow script defer/async attributes w/o src (sideshowbarker著, ) https://github.com/whatwg/html/commit/3c5180a08f90a375c64f8191f32f8c7ddfec0ba3

[553] Properly instantiate inline module scripts (domenic著, ) https://github.com/whatwg/html/commit/3a3405a42de289ecb08e915b278064a99794731d

[555] Allow not executing scripts inserted by document.write() (domenic著, ) https://github.com/whatwg/html/commit/15b258dc74ffe1ba321b81a1c876f129681a97c2

[558] For users on very slow connections, block document.written scripts · Issue #17 · WICG/interventions () https://github.com/WICG/interventions/issues/17

[559] Allow not executing scripts inserted by document.write() by domenic · Pull Request #1400 · whatwg/html () https://github.com/whatwg/html/pull/1400

[560] Intervening against document.write()  |  Web  |  Google Developers () https://developers.google.com/web/updates/2016/08/removing-document-write

[561] Improve <style> and <script> processing and conformance by domenic · Pull Request #3024 · whatwg/html () https://github.com/whatwg/html/pull/3024

[562] Clarify prose around JavaScript MIME types (annevk著, ) https://github.com/whatwg/html/commit/470e168aaddc54e0abcfa302639870c299473c99

[563] Editorial: refactor classic and module scripts to be more alike (domenic著, ) https://github.com/whatwg/html/commit/dce999aac4d9deeefa3b338dd2aeb30c17669bc8

[564] Editorial: refactor classic and module scripts to be more alike (domenic著, ) https://github.com/whatwg/html/commit/dce999aac4d9deeefa3b338dd2aeb30c17669bc8

[565] Editorial: refactor classic and module scripts to be more alike by domenic · Pull Request #2972 · whatwg/html () https://github.com/whatwg/html/pull/2972

[566] Editorial: move base URL from "module script" to "script" (domenic著, ) https://github.com/whatwg/html/commit/5458513792ab00d58e6c91ba48faaa611d034a2e

[567] Make integrity="" work on module scripts (domenic著, ) https://github.com/whatwg/html/commit/9275d955dcd604e959cfcc672e0c234b1b8c00db

[517] Make integrity="" work on module scripts (domenic著, ) https://github.com/whatwg/html/commit/9275d955dcd604e959cfcc672e0c234b1b8c00db

[519] Does integrity="" intentionally not work on module <script>s? · Issue #2382 · whatwg/html () https://github.com/whatwg/html/issues/2382

[543] Require UTF-8 (sideshowbarker著, ) https://github.com/whatwg/html/commit/fae77e3c558b9f083dfb9086752863a4789268f5

[544] Allow UAs to conditionally block on stylesheet loading (domfarolino著, ) https://github.com/whatwg/html/commit/42dd707cbfc0f5d8f88b04ef270f4fcb121a10ff

[569] Editorial: use "child text content" in the <script> processing model (ankurkaushal著, ) https://github.com/whatwg/html/commit/58286f7078b3aceee060ed6d3635ab8749a77238

[570] <script> processing model should use child text content, not the text IDL attribute · Issue #3420 · whatwg/html () https://github.com/whatwg/html/issues/3420

[571] #3420: Editorial fix for the <script> processing model. by ankurkaushal · Pull Request #3421 · whatwg/html () https://github.com/whatwg/html/pull/3421

[572] Use "child text content" to check if a <script> is empty (domenic著, ) https://github.com/whatwg/html/commit/1d64c41e811aab5831be474355bd346c9eaf2874

[328] <script> processing model with various children · Issue #3419 · whatwg/html () https://github.com/whatwg/html/issues/3419

[574] Use "child text content" to check if a <script> is empty by domenic · Pull Request #3451 · whatwg/html () https://github.com/whatwg/html/pull/3451

[575] Editorial: update usage of the MIME Sniffing Standard (domenic著, ) https://github.com/whatwg/html/commit/fc82f4f8774a2e7e80f6c9477bd881f6c783b186

[576] Editorial: update usage of the MIME Sniffing Standard by domenic · Pull Request #3455 · whatwg/html () https://github.com/whatwg/html/pull/3455

[577] Fix authoring guidance to allow async="" on inline module scripts (domenic著, ) https://github.com/whatwg/html/commit/271f19c34786db04a17c16c24807a33113894a68

[578] async="" should be allowed on inline module scripts · Issue #3319 · whatwg/html () https://github.com/whatwg/html/issues/3319

[579] Fix authoring guidance to allow async="" on inline module scripts by domenic · Pull Request #3324 · whatwg/html () https://github.com/whatwg/html/pull/3324

[580] Fix authoring guidance to allow async="" on inline module scripts by domenic · Pull Request #3324 · whatwg/html () https://github.com/whatwg/html/pull/3324

[582] Allow <script> inside <hgroup> (annevk著, ) https://github.com/whatwg/html/commit/9bc8dee5ace8a8c01b9a621b4cda3377867065f1

[583] [acgiowt] (2) Catch up with recent changes that were made while the p… (Hixie著, ) https://github.com/whatwg/html/commit/d2021df727adb22ee6d4c7e7968aa5abbd93a307

[584] Allow <script> inside <hgroup> by annevk · Pull Request #3383 · whatwg/html () https://github.com/whatwg/html/pull/3383

[585] Add referrerpolicy attribute support to <script>s (domfarolino著, ) https://github.com/whatwg/html/commit/0d28f8fc3a7c272f6d148f647ead29965a56ab60

[586] Why no referrerpolicy="" on <script>? · Issue #96 · w3c/webappsec-referrer-policy () https://github.com/w3c/webappsec-referrer-policy/issues/96

[587] Add referrerpolicy attribute support to <script>s by domfarolino · Pull Request #3678 · whatwg/html () https://github.com/whatwg/html/pull/3678

[588] Return the completion record result from running a script (mattto著, ) https://github.com/whatwg/html/commit/ad3dda51552aeeeea60540c7f1b513fe45b486a5

[589] Stop using textContent in normative text (annevk著, ) https://github.com/whatwg/html/commit/ec860d872de3712277242655562a4d2a1325592a