NamedConstructor

[NamedConstructor] 拡張属性 (Web IDL)

仕様書

文脈

[3] NamedConstructor 拡張属性は、インターフェイスに指定できます >>1。ただしコールバックインターフェイスには指定できません >>1。

[5] 複数個拡張属性を指定できます >>1。

引数

[2] 識別子を指定するか、名前付き引数リスト (識別子と引数のリスト) を指定するかのいずれかでなければなりません >>1。識別子のみの場合は、 引数リストが空であるものとみなされます >>1。

[6] 識別子は、他のインターフェイスの NamedConstructor の識別子と同じであってはなりません >>1。

[7] 識別子は、インターフェイスオブジェクトを持つインターフェイスや例外インターフェイスオブジェクトを持つ例外の識別子と同じであってはなりません >>1。

[8] 識別子は、予約識別子であってはなりません >>1。

[10] 同じインターフェイスに異なる識別子の NamedConstructor が存在することは禁止されていません。
[11] 同じインターフェイスに Constructor が存在することも禁止されていません。

効果

[4] 大域オブジェクトに識別子で指定された名前の特性があって、 その値が当該インターフェイスを実装したオブジェクトを作るコンストラクター関数となることを表します >>1。

[9] 同じ識別子の拡張属性が複数ある場合には、 overload と解釈されます。

名前付きコンストラクター

[14] 晒される状態にあるインターフェイスで NamedConstructor 拡張属性があるものは、大域オブジェクトのその識別子と同じ名前の特性に Function が設定されます。 >>12, >>13

[16] 名前付き構築子は、初期オブジェクトです。

[17] 次のものがあります。

[18] Revamp interface bindings (#313) (tobie著, ) https://github.com/heycam/webidl/commit/4a8f57e276369db7ea5fb09974a09b0ca5d276dd

[19] Clarify object creation in named constructors (#652) (Ms2ger著, ) https://github.com/heycam/webidl/commit/c9246d42fb9c0e399bb9b762f76917c9f43534e3

[20] Clarify object creation in named constructors by Ms2ger · Pull Request #652 · heycam/webidl () https://github.com/heycam/webidl/pull/652

[21] Disallow combining Global with Constructor/NamedConstructor. (#745) (Ms2ger著, ) https://github.com/heycam/webidl/commit/a029460787be46f850abfc60f35cc6da05145b89

[22] Disallow combining Global with Constructor/NamedConstructor. by Ms2ger · Pull Request #745 · heycam/webidl () https://github.com/heycam/webidl/pull/745

[23] Should make it clear that [Global] and [Constructor] can't coexist · Issue #744 · heycam/webidl () https://github.com/heycam/webidl/issues/744

[24] Stop using extended attributes for constructors (Ms2ger著, ) https://github.com/heycam/webidl/commit/91ca6ebb4d4fca9703309e19256bbc5f5dd77e3c