一部のIDL属性は、特定のコンテンツ属性の反映を定義する。これは、そのIDL属性がコンテンツ属性の現在値を返し、そのIDL属性が与えられた値にコンテンツ属性の値を変更することを意味する。
In general, on getting, if the content attribute is not present, the IDL attribute must act as if the content attribute's value is the empty string; and on setting, if the content attribute is not present, it must first be added.
IDL attributes of type DOMString
or DOMString?
that reflect enumerated content attributes can be limited to only known values. Per the processing models below, those will cause the getters for such IDL attributes to only return keywords for those enumerated attributes, or the empty string or null.
If a reflecting IDL attribute has the type DOMString
:
The getter steps are:
If the content attribute is an enumerated attribute, and the IDL attribute is limited to only known values:
If the content attribute is not in any state (e.g. the attribute is missing and there is no missing value default), or the content attribute is in a state with no associated keyword value, then return the empty string.
Return the canonical keyword for the state of the content attribute.
Otherwise:
Return the content attribute's value.
The setter steps are to set the content attribute's value to the given value.
If a reflecting IDL attribute has the type DOMString?
:
The getter steps are:
Assert: the content attribute is an enumerated attribute.
Assert: the IDL attribute is limited to only known values.
Assert: the content attribute is in some state.
If the content attribute is in a state with no associated keyword value, then return null.
Return the canonical keyword for the state of the content attribute.
The setter steps are:
If the given value is null, then remove the content attribute.
Otherwise, set the content attribute's value to the given value.
If a reflecting IDL attribute has the type USVString
:
The getter steps are:
If the content attribute is defined to contain a URL:
If the content attribute is absent, then return the empty string.
Parse the value of the content attribute relative to the element's node document.
If that is successful, then return the resulting URL string.
Otherwise, return the value of the content attribute, converted to a USVString
.
Otherwise:
The setter steps are to set the content attribute's value to the given value.
If a reflecting IDL attribute is a boolean
attribute, then on getting the IDL attribute must return true if the content attribute is set, and false if it is absent. On setting, the content attribute must be removed if the IDL attribute is set to false, and must be set to the empty string if the IDL attribute is set to true. (This corresponds to the rules for boolean content attributes.)
If a reflecting IDL attribute has a signed integer type (long
) then, on getting, the content attribute must be parsed according to the rules for parsing signed integers, and if that is successful, and the value is in the range of the IDL attribute's type, the resulting value must be returned. If, on the other hand, it fails or returns an out of range value, or if the attribute is absent, then the default value must be returned instead, or 0 if there is no default value. On setting, the given value must be converted to the shortest possible string representing the number as a valid integer and then that string must be used as the new content attribute value.
If a reflecting IDL attribute has a signed integer type (long
) that is limited to only non-negative numbers then, on getting, the content attribute must be parsed according to the rules for parsing non-negative integers, and if that is successful, and the value is in the range of the IDL attribute's type, the resulting value must be returned. If, on the other hand, it fails or returns an out of range value, or if the attribute is absent, the default value must be returned instead, or −1 if there is no default value. On setting, if the value is negative, the user agent must throw an "IndexSizeError
" DOMException
. Otherwise, the given value must be converted to the shortest possible string representing the number as a valid non-negative integer and then that string must be used as the new content attribute value.
If a reflecting IDL attribute has an unsigned integer type (unsigned long
) then, on getting, the content attribute must be parsed according to the rules for parsing non-negative integers, and if that is successful, and the value is in the range 0 to 2147483647 inclusive, the resulting value must be returned. If, on the other hand, it fails or returns an out of range value, or if the attribute is absent, the default value must be returned instead, or 0 if there is no default value. On setting, first, if the new value is in the range 0 to 2147483647, then let n be the new value, otherwise let n be the default value, or 0 if there is no default value; then, n must be converted to the shortest possible string representing the number as a valid non-negative integer and that string must be used as the new content attribute value.
If a reflecting IDL attribute has an unsigned integer type (unsigned long
) that is limited to only non-negative numbers greater than zero, then the behavior is similar to the previous case, but zero is not allowed. On getting, the content attribute must first be parsed according to the rules for parsing non-negative integers, and if that is successful, and the value is in the range 1 to 2147483647 inclusive, the resulting value must be returned. If, on the other hand, it fails or returns an out of range value, or if the attribute is absent, the default value must be returned instead, or 1 if there is no default value. On setting, if the value is zero, the user agent must throw an "IndexSizeError
" DOMException
. Otherwise, first, if the new value is in the range 1 to 2147483647, then let n be the new value, otherwise let n be the default value, or 1 if there is no default value; then, n must be converted to the shortest possible string representing the number as a valid non-negative integer and that string must be used as the new content attribute value.
If a reflecting IDL attribute has an unsigned integer type (unsigned long
) that is limited to only non-negative numbers greater than zero with fallback, then the behavior is similar to the previous case, but disallowed values are converted to the default value. On getting, the content attribute must first be parsed according to the rules for parsing non-negative integers, and if that is successful, and the value is in the range 1 to 2147483647 inclusive, the resulting value must be returned. If, on the other hand, it fails or returns an out of range value, or if the attribute is absent, the default value must be returned instead. On setting, first, if the new value is in the range 1 to 2147483647, then let n be the new value, otherwise let n be the default value; then, n must be converted to the shortest possible string representing the number as a valid non-negative integer and that string must be used as the new content attribute value.
If a reflecting IDL attribute has an unsigned integer type (unsigned long
) that is clamped to the range [min, max], then on getting, the content attribute must first be parsed according to the rules for parsing non-negative integers, and if that is successful, and the value is between min and max inclusive, the resulting value must be returned. If it fails, the default value must be returned. If it succeeds but the value is less than min, min must be returned. If it succeeds but the value is greater than max, max must be returned. On setting, it behaves the same as setting a regular reflected unsigned integer.
If a reflecting IDL attribute has a floating-point number type (double
or unrestricted double
), then, on getting, the content attribute must be parsed according to the rules for parsing floating-point number values, and if that is successful, the resulting value must be returned. If, on the other hand, it fails, or if the attribute is absent, the default value must be returned instead, or 0.0 if there is no default value. On setting, the given value must be converted to the best representation of the number as a floating-point number and then that string must be used as the new content attribute value.
If a reflecting IDL attribute has a floating-point number type (double
or unrestricted double
) that is limited to numbers greater than zero, then the behavior is similar to the previous case, but zero and negative values are not allowed. On getting, the content attribute must be parsed according to the rules for parsing floating-point number values, and if that is successful and the value is greater than 0.0, the resulting value must be returned. If, on the other hand, it fails or returns an out of range value, or if the attribute is absent, the default value must be returned instead, or 0.0 if there is no default value. On setting, if the value is less than or equal to zero, then the value must be ignored. Otherwise, the given value must be converted to the best representation of the number as a floating-point number and then that string must be used as the new content attribute value.
The values Infinity and Not-a-Number (NaN) values throw an exception on setting, as defined in Web IDL. [WEBIDL]
If a reflecting IDL attribute has the type DOMTokenList
, then on getting it must return a DOMTokenList
object whose associated element is the element in question and whose associated attribute's local name is the name of the attribute in question.
If a reflecting IDL attribute attr has the type T?
, where T is either Element
or an interface that inherits from Element
, then:
Elements of the type this IDL attribute appears on have an explicitly set attr-element, which is a weak reference to an element or null. 最初はnullである。
Elements of the type this IDL attribute appears on have an attr-associated element. To compute the attr-associated element for such an element element:
If element's explicitly set attr-element is not null:
If element's explicitly set attr-element is a descendant of any of element's shadow-including ancestors, then return element's explicitly set attr-element.
Otherwise, return null.
Otherwise, if the content attribute is present on element, then return the first element candidate, in tree order, that meets the following criteria:
If no such element exists, then return null.
Return null.
Other parts of this specification, or other specifications using attribute reflection, are expected to consult an element's attr-associated element. An element's explicitly set attr-element is an internal implementation detail of its attr-associated element and is not to be used directly.
The getter steps are to return this's attr-associated element.
The setter steps are:
If the given value is null, then:
Set this's explicitly set attr-element to null.
Remove the content attribute from this.
Return.
Let id be the empty string.
If the given value:
id
attribute, andid
attribute,then set id to the given value's ID.
Set the content attribute's value for this to id.
Set this's explicitly set attr-element to a weak reference to the given value.
The following attribute change steps, given element, localName, oldValue, value, and namespace, are used to synchronize between the content attribute and the IDL attribute:
If localName is not the content attribute's local name, or namespace is not null, then return.
Set element's explicitly set attr-element to null.
If a reflecting IDL attribute attr has the type FrozenArray<T>?
, where T is either Element
or an interface that inherits from Element
, then:
Elements of the type this IDL attribute appears on have explicitly set attr-elements, which is either a list of weak references to elements or null. 最初はnullである。
Elements of the type this IDL attribute appears on have cached attr-associated elements, which is a FrozenArray<T>?
. 最初はnullである。
Elements of the type this IDL attribute appears on have attr-associated elements. To compute the attr-associated elements for such an element element:
Let elements be an empty list.
If element's explicitly set attr-elements is not null, then:
For each attrElement in the element's explicitly set attr-elements:
If attrElement is not a descendant of any of element's shadow-including ancestors, then continue.
Append attrElement to elements.
Otherwise:
If the content attribute is not present on element, return null.
Let tokens be the content attribute's value, split on ASCII whitespace.
For each id in tokens:
Let candidate be the first element, in tree order, that meets the following criteria:
If no such element exists, then continue.
Append candidate to elements.
Return elements.
Other parts of this specification, or other specifications using attribute reflection, are expected to consult an element's attr-associated elements. An element's explicitly set attr-elements is an internal implementation detail of its attr-associated elements and is not to be used directly. Similarly, the element's cached attr-associated elements is an internal implementation detail of the IDL attribute's getter.
The getter steps are:
Let elements be this's attr-associated elements.
If the contents of elements is equal to the contents of this's cached attr-associated elements, then return this's cached attr-associated elements.
Let elementsAsFrozenArray be elements, converted to a FrozenArray<T>?
.
Set this's cached attr-associated elements to elementsAsFrozenArray.
Return elementsAsFrozenArray.
This extra caching layer is necessary to preserve the invariant that element.reflectedElements === element.reflectedElements
.
The setter steps are:
If the given value is null:
Set this's explicitly set attr-elements to null.
Remove the content attribute from this.
Return.
Let value be an empty string.
For each element in the given value:
If value is empty and elements is non-empty, then:
Append a weak reference to element to elements.
If element:
id
attribute, orid
attribute,then set value to the empty string, and continue.
Let id be element's ID.
If value is not the empty string, then append U+0020 SPACE to value.
Append id to value.
Set the content attribute's value for this to value.
Set this's explicitly set attr-elements to elements.
The following attribute change steps, given element, localName, oldValue, value, and namespace, are used to synchronize between the content attribute and the IDL attribute:
If localName is not the content attribute's local name, or namespace is not null, then return.
Set element's explicitly set attr-elements to null.
HTMLFormControlsCollection
およびHTMLOptionsCollection
インターフェイスは、HTMLCollection
インターフェイスから派生するコレクションである。HTMLAllCollection
インターフェイスはコレクションであるが、派生ではない。
HTMLAllCollection
インターフェイスHTMLAllCollection
インターフェイスは、レガシーdocument.all
属性に対して使用される。このインターフェイスは、HTMLCollection
と類似の動作をする。主な違いは、このインターフェイスが完全に最後には何かを返すことになるためにそのメソッドの驚くほどさまざまな異なる(不正)利用を可能にし、プロパティアクセスの代替としての機能として呼び出すことができることということである。
すべてのHTMLAllCollection
オブジェクトは、Document
でルート化され、すべての要素とマッチするフィルターを持つ。その結果HTMLAllCollection
オブジェクトのコレクションによって表される要素は、ルートDocument
のすべての子孫要素から成る。
Objects that implement the HTMLAllCollection
interface are legacy platform objects with an additional [[Call]] internal method described in the section below. They also have an [[IsHTMLDDA]] internal slot.
HTMLAllCollection
インターフェイスを実装するオブジェクトには、[[IsHTMLDDA]]内部スロットを持つという事実のために、いくつかの独特な動作を持つ。
HTMLAllCollection
インターフェイスを実装している指定されるオブジェクトの場合、JavaScriptのToBoolean抽象演算はfalseを返す。
Abstract Equality Comparisonアルゴリズムは、HTMLAllCollection
インターフェイスを実装しているオブジェクトが指定される場合、undefined
およびnull
値と比較するときtrueを返す。(Strict Equality Comparisonアルゴリズムと、文字列やオブジェクトなどの他の値との抽象的な等価比較を使用した比較は影響を受けない)。
JavaScriptにおけるtypeof
演算子は、HTMLAllCollection
インターフェイスを実装しているオブジェクトに適用する場合、文字列"undefined"
を返す。
これらの特別な振る舞いは、レガシーコンテンツの2つのクラスとの互換性への要望によって動機付けられている:1つはレガシーユーザーエージェントを検出する手段としてdocument.all
の存在を利用するものであり、もう1つはそれらのレガシーユーザーエージェントのみをサポートし、その存在を最初にテストすることなくdocument.all
オブジェクトを利用するもののである。[JAVASCRIPT]
[Exposed =Window ,
LegacyUnenumerableNamedProperties ]
interface HTMLAllCollection {
readonly attribute unsigned long length ;
getter Element (unsigned long index );
getter (HTMLCollection or Element )? namedItem (DOMString name );
(HTMLCollection or Element )? item (optional DOMString nameOrIndex );
// Note: HTMLAllCollection objects have a custom [[Call]] internal method and an [[IsHTMLDDA]] internal slot.
};
The object's supported property indices are as defined for HTMLCollection
objects.
The supported property names consist of the non-empty values of all the id
attributes of all the elements represented by the collection, and the non-empty values of all the name
attributes of all the "all"-named elements represented by the collection, in tree order, ignoring later duplicates, with the id
of an element preceding its name
if it contributes both, they differ from each other, and neither is the duplicate of an earlier entry.
The length
getter steps are to return the number of nodes represented by the collection.
The indexed property getter must return the result of getting the "all"-indexed element from this given the passed index.
The namedItem(name)
method steps are to return the result of getting the "all"-named element(s) from this given name.
The item(nameOrIndex)
method steps are:
If nameOrIndex was not provided, return null.
Return the result of getting the "all"-indexed or named element(s) from this, given nameOrIndex.
The following elements are "all"-named elements: a
, button
, embed
, form
, frame
, frameset
, iframe
, img
, input
, map
, meta
, object
, select
, and textarea
To get the "all"-indexed element from an HTMLAllCollection
collection given an index index, return the indexth element in collection, or null if there is no such indexth element.
To get the "all"-named element(s) from an HTMLAllCollection
collection given a name name, perform the following steps:
If name is the empty string, return null.
Let subCollection be an HTMLCollection
object rooted at the same Document
as collection, whose filter matches only elements that are either:
"all"-named elements with a name
attribute equal to name, or,
elements with an ID equal to name.
If there is exactly one element in subCollection, then return that element.
Otherwise, if subCollection is empty, return null.
Otherwise, return subCollection.
To get the "all"-indexed or named element(s) from an HTMLAllCollection
collection given nameOrIndex:
If nameOrIndex, converted to a JavaScript String value, is an array index property name, return the result of getting the "all"-indexed element from collection given the number represented by nameOrIndex.
Return the result of getting the "all"-named element(s) from collection given nameOrIndex.
If argumentsList's size is zero, or if argumentsList[0] is undefined, return null.
Let nameOrIndex be the result of converting argumentsList[0] to a DOMString
.
Let result be the result of getting the "all"-indexed or named element(s) from this HTMLAllCollection
given nameOrIndex.
Return the result of converting result to an ECMAScript value.
The thisArgument is ignored, and thus code such as Function.prototype.call.call(document.all, null, "x")
will still search for elements. (document.all.call
does not exist, since document.all
does not inherit from Function.prototype
.)
HTMLFormControlsCollection
インターフェイスHTMLFormControlsCollection
インターフェイスは、form
要素で記載要素のコレクションに使用される。
Support in all current engines.
Support in all current engines.
[Exposed =Window ]
interface HTMLFormControlsCollection : HTMLCollection {
// inherits length and item()
getter (RadioNodeList or Element )? namedItem (DOMString name ); // shadows inherited namedItem()
};
[Exposed =Window ]
interface RadioNodeList : NodeList {
attribute DOMString value ;
};
collection.length
collectionの要素数を返す。
element = collection.item(index)
element = collection[index]
collectionのインデックスindexにあるアイテムを返す。アイテムはツリー順にソートされる。
element = collection.namedItem(name)
HTMLFormControlsCollection/namedItem
Support in all current engines.
radioNodeList = collection.namedItem(name)
element = collection[name]
radioNodeList = collection[name]
collection.からのIDまたはname
nameとともにアイテムを返す。
複数のマッチするアイテムが存在する場合、それらの要素すべてを含むRadioNodeList
オブジェクトが返される。
radioNodeList.value
radioNodeListで表される最初にチェックされたラジオボタンの値を返す。
radioNodeList.value = value
値 valueを持つradioNodeListで表される最初の最初のラジオボタンをチェックする。
The object's supported property indices are as defined for HTMLCollection
objects.
The supported property names consist of the non-empty values of all the id
and name
attributes of all the elements represented by the collection, in tree order, ignoring later duplicates, with the id
of an element preceding its name
if it contributes both, they differ from each other, and neither is the duplicate of an earlier entry.
The namedItem(name)
method must act according to the following algorithm:
id
attribute or a name
attribute equal to name, then return that node and stop the algorithm.id
attribute or a name
attribute equal to name, then return null and stop the algorithm.RadioNodeList
object representing a live view of the HTMLFormControlsCollection
object, further filtered so that the only nodes in the RadioNodeList
object are those that have either an id
attribute or a name
attribute equal to name. The nodes in the RadioNodeList
object must be sorted in tree order.RadioNodeList
object.Members of the RadioNodeList
interface inherited from the NodeList
interface must behave as they would on a NodeList
object.
Support in all current engines.
The value
IDL attribute on the RadioNodeList
object, on getting, must return the value returned by running the following steps:
Let element be the first element in tree order represented by the RadioNodeList
object that is an input
element whose type
attribute is in the Radio Button state and whose checkedness is true. Otherwise, let it be null.
If element is null, return the empty string.
If element is an element with no value
attribute, return the string "on
".
Otherwise, return the value of element's value
attribute.
On setting, the value
IDL attribute must run the following steps:
If the new value is the string "on
": let element be the first element in tree order represented by the RadioNodeList
object that is an input
element whose type
attribute is in the Radio Button state and whose value
content attribute is either absent, or present and equal to the new value, if any. If no such element exists, then instead let element be null.
Otherwise: let element be the first element in tree order represented by the RadioNodeList
object that is an input
element whose type
attribute is in the Radio Button state and whose value
content attribute is present and equal to the new value, if any. If no such element exists, then instead let element be null.
If element is not null, then set its checkedness to true.
HTMLOptionsCollection
インターフェイスSupport in all current engines.
HTMLOptionsCollection
インターフェイスは、option
要素のコレクションに使用される。常にselect
要素がルートであり、要素の子孫をコントロールする属性およびメソッドを持つ。
[Exposed =Window ]
interface HTMLOptionsCollection : HTMLCollection {
// inherits item(), namedItem()
[CEReactions ] attribute unsigned long length ; // shadows inherited length
[CEReactions ] setter undefined (unsigned long index , HTMLOptionElement ? option );
[CEReactions ] undefined add ((HTMLOptionElement or HTMLOptGroupElement ) element , optional (HTMLElement or long )? before = null );
[CEReactions ] undefined remove (long index );
attribute long selectedIndex ;
};
collection.length
collectionの要素数を返す。
collection.length = value
既存の長さよりも小さい数に設定するとき、collectionに対応するコンテナー内のoption
要素の数が切り捨てられる。
既存の長さよりも大きい数に設定するとき、collectionに対応するコンテナーに新しい空のoption
要素が追加される。
element = collection.item(index)
element = collection[index]
collectionのインデックスindexにあるアイテムを返す。アイテムはツリー順にソートされる。
collection[index] = element
indexがコレクションで項目の数より大きい数である場合、対応するコンテナーで新しい空白のoption
要素を追加する。
nullに設定する場合、collectionからインデックスindexで項目を削除する。
option
要素に設定するとき、collectionのインデックスindexで追加または置換される。
element = collection.namedItem(name)
element = collection[name]
collection.からのIDまたはname
nameとともにアイテムを返す。
複数のマッチするアイテムが存在する場合、最初のものが返される。
collection.add(element[, before])
beforeによって与えられるノードの前の要素を挿入する。
before引数は数字でもよく、その場合elementはその数字をもつアイテムの前に挿入され、またはcollectionからの要素でもよい。その場合elementはその要素の前に挿入される。
beforeが省略された、null、または範囲外の数字の場合、elementはリストの最後に加えられるだろう。
elementに挿入された要素が親要素である場合、"HierarchyRequestError
" DOMException
を投げる。
collection.remove(index)
collectionからのインデックスindexをもつ項目を削除する。
collection.selectedIndex
もしあるならば、最初に選ばれたアイテムのインデックスを、または選択したアイテムが存在しない場合−1を返す。
collection.selectedIndex = index
collection内のインデックスindexのoption
要素に選択を変更する。
The object's supported property indices are as defined for HTMLCollection
objects.
On getting, the length
attribute must return the number of nodes represented by the collection.
On setting, the behavior depends on whether the new value is equal to, greater than, or less than the number of nodes represented by the collection at that time. If the number is the same, then setting the attribute must do nothing. If the new value is greater, then n new option
elements with no attributes and no child nodes must be appended to the select
element on which the HTMLOptionsCollection
is rooted, where n is the difference between the two numbers (new value minus old value). Mutation events must be fired as if a DocumentFragment
containing the new option
elements had been inserted. If the new value is lower, then the last n nodes in the collection must be removed from their parent nodes, where n is the difference between the two numbers (old value minus new value).
Setting length
never removes or adds any optgroup
elements, and never adds new children to existing optgroup
elements (though it can remove children from them).
The supported property names consist of the non-empty values of all the id
and name
attributes of all the elements represented by the collection, in tree order, ignoring later duplicates, with the id
of an element preceding its name
if it contributes both, they differ from each other, and neither is the duplicate of an earlier entry.
When the user agent is to set the value of a new indexed property or set the value of an existing indexed property for a given property index index to a new value value, it must run the following algorithm:
If value is null, invoke the steps for the remove
method with index as the argument, and return.
Let length be the number of nodes represented by the collection.
Let n be index minus length.
If n is greater than zero, then append a DocumentFragment
consisting of n-1 new option
elements with no attributes and no child nodes to the select
element on which the HTMLOptionsCollection
is rooted.
If n is greater than or equal to zero, append value to the select
element. Otherwise, replace the indexth element in the collection by value.
The add(element, before)
method must act according to the following algorithm:
If element is an ancestor of the select
element on which the HTMLOptionsCollection
is rooted, then throw a "HierarchyRequestError
" DOMException
.
If before is an element, but that element isn't a descendant of the select
element on which the HTMLOptionsCollection
is rooted, then throw a "NotFoundError
" DOMException
.
If element and before are the same element, then return.
If before is a node, then let reference be that node. Otherwise, if before is an integer, and there is a beforeth node in the collection, let reference be that node. Otherwise, let reference be null.
If reference is not null, let parent be the parent node of reference. Otherwise, let parent be the select
element on which the HTMLOptionsCollection
is rooted.
Pre-insert element into parent node before reference.
The remove(index)
method must act according to the following algorithm:
If the number of nodes represented by the collection is zero, return.
If index is not a number greater than or equal to 0 and less than the number of nodes represented by the collection, return.
Let element be the indexth element in the collection.
Remove element from its parent node.
The selectedIndex
IDL attribute must act like the identically named attribute on the select
element on which the HTMLOptionsCollection
is rooted
DOMStringList
インターフェイスSupport in all current engines.
DOMStringList
インターフェイスは、文字列のリストを表現する非流行のレトロな方法である。
[Exposed =(Window ,Worker )]
interface DOMStringList {
readonly attribute unsigned long length ;
getter DOMString ? item (unsigned long index );
boolean contains (DOMString string );
};
新しいAPIは、DOMStringList
よりもむしろsequence<DOMString>
または同等のものを使用しなければならない。
strings.length
strings内の文字列の数を返す。
strings[index]
strings.item(index)
stringsからインデックスindexをもつ文字列を返す。
strings.contains(string)
stringsにstringが含まれる場合はtrueを返し、そうでなければfalseを返す。
Each DOMStringList
object has an associated list.
The DOMStringList
interface supports indexed properties. The supported property indices are the indices of this's associated list.
The length
getter steps are to return this's associated list's size.
The item(index)
method steps are to return the indexth item in this's associated list, or null if index plus one is greater than this's associated list's size.
The contains(string)
method steps are to return true if this's associated list contains string, and false otherwise.