From c7042eb560620eb2db9ccd257e605daab40672c6 Mon Sep 17 00:00:00 2001
From: Boris Zbarsky instead write the following:
- 1. If |P| is an [=unforgeable property name=]
- on |O|, then return false.
- 1. If |O| implements an [=interface=] with
- an [{{Unforgeable}}]-annotated [=attribute=]
- whose [=identifier=] is |P|, then return false.
1. If |P| is not a [=supported property name=]
of |O|, then return false.
+ 1. If |O| has an own property named |P|, then return false.
+
+ Note: This will include cases in which |O| has unforgeable properties, because in practice those are always set up before objects have any supported property names, and once set up will make the corresponding named properties invisible.
+
1. If |O| implements an interface that has the [{{OverrideBuiltins}}]
[=extended attribute=], then return true.
- 1. If |O| has an own property named |P|, then return false.
1. Initialize |prototype| to be the value of the internal \[[Prototype]] property of |O|.
1. While |prototype| is not null:
1. If |prototype| is not a [=named properties object=],
@@ -12223,16 +12221,12 @@ operates as follows, with property name |P| and object |O|:
This should ensure that for objects with named properties, property resolution is done in the following order:
1. Indexed properties.
- 1. Unforgeable attributes and operations.
+ 1. Own properties, including unforgeable attributes and operations.
1. Then, if [{{OverrideBuiltins}}]:
1. Named properties.
- 1. Own properties.
1. Properties from the prototype chain.
1. Otherwise, if not [{{OverrideBuiltins}}]:
- 1. Own properties.
-
1. Properties from the prototype chain.
-
1. Named properties.
diff --git a/index.html b/index.html
index 298dc083..926714b2 100644
--- a/index.html
+++ b/index.html
@@ -1963,7 +1963,7 @@
attribute long something;
};
-
// This is an ECMAScript code block.
+
// This is an ECMAScript code block.
window.onload = function() { window.alert("loaded"); };
2. Conformance
@@ -2397,7 +2397,7 @@ var a = getA(); // Get an instance of A.
+
var a = getA(); // Get an instance of A.
a.doTask("something", { option1: "banana", option3: 100 });
EventListener interface is annotated
callback interface, user objects can implement it:
var node = getNode(); // Obtain an instance of Node. +var node = getNode(); // Obtain an instance of Node. var listener = { handleEvent: function(event) { @@ -2549,7 +2549,7 @@node.addEventListener("click", function() { ... }); // As does this.
It is not possible for a user object to implement
-Node
, however:var node = getNode(); // Obtain an instance of Node. +var node = getNode(); // Obtain an instance of Node. var newNode = { nodeName: "span", @@ -3010,7 +3010,7 @@var s = getIntegerSet(); // Obtain an instance of IntegerSet. +
var s = getIntegerSet(); // Obtain an instance of IntegerSet. s.union(); // Passing no arguments corresponding to 'ints'. s.union(1, 4, 7); // Passing three arguments corresponding to 'ints'.@@ -3325,7 +3325,7 @@
An ECMAScript implementation supporting this interface would allow a platform object that implements
-NumberQuadrupler
to be called as a function:var f = getNumberQuadrupler(); // Obtain an instance of NumberQuadrupler. +var f = getNumberQuadrupler(); // Obtain an instance of NumberQuadrupler. f.compute(3); // This evaluates to 12. f(3); // This also evaluates to 12.@@ -3398,7 +3398,7 @@In the ECMAScript binding, using a
Student
object in a context where a string is expected will result in the value of the object’s “name” property being used: -var s = new Student(); +var s = new Student(); s.id = 12345678; s.name = '周杰倫'; @@ -3425,7 +3425,7 @@familyName attribute.
An ECMAScript implementation of the IDL would behave as follows:
-var s = new Student(); +var s = new Student(); s.id = 12345679; s.familyName = 'Smithee'; s.givenName = 'Alan'; @@ -3804,7 +3804,7 @@
In the ECMAScript language binding, there would exist a
-toJSON
method onTransaction
objects:// Get an instance of Transaction. +// Get an instance of Transaction. var txn = getTransaction(); // Evaluates to an object like this: @@ -3868,7 +3868,7 @@Assume that an object implementing
A
has supported property indices in the range 0 ≤ index < 2. Also assume that toWord is defined to return its argument converted into an English word. The behavior when invoking the operation with an out of range index is different from indexing the object directly: -var a = getA(); +var a = getA(); a.toWord(0); // Evalautes to "zero". a[0]; // Also evaluates to "zero". @@ -3910,7 +3910,7 @@-
// Assume map is a platform object implementing the OrderedMap interface. +// Assume map is a platform object implementing the OrderedMap interface. var map = getOrderedMap(); var x, y; @@ -4027,7 +4027,7 @@interface object for
Circle
: -var circles = getCircles(); // an Array of Circle objects +var circles = getCircles(); // an Array of Circle objects typeof Circle.triangulate; // Evaluates to "function" typeof Circle.triangulationCount; // Evaluates to "number" @@ -4605,7 +4605,7 @@@@iterator method that allows a
SessionManager
to be used in afor..of
loop: -// Get an instance of SessionManager. +// Get an instance of SessionManager. // Assume that it has sessions for two users, "anna" and "brian". var sm = getSessionManager(); @@ -4625,7 +4625,7 @@@@ -4786,7 +4786,7 @@} // This loop will also alert "anna" and then "brian". -for (let session of sm) { +for (let session of sm) { window.alert(session.username); }
%ObjectPrototype%) with enumerable data properties for each declared operation: -
Object.getPrototypeOf(VectorUtils); // Evaluates to Object.prototype. +Object.getPrototypeOf(VectorUtils); // Evaluates to Object.prototype. Object.keys(VectorUtils); // Evaluates to ["dotProduct", "crossProduct"]. Object.getOwnPropertyDescriptor(VectorUtils, "dotProduct"); // Evaluates to { value: <a function>, enumerable: true, configurable: true, writable: true }.@@ -4942,7 +4942,7 @@var something = getSomething(); // Get an instance of Something. +
var something = getSomething(); // Get an instance of Something. var x = 0; var dict = { }; @@ -5013,7 +5013,7 @@PaintOptions dictionary: -
// Get an instance of GraphicsContext. +// Get an instance of GraphicsContext. var ctx = getGraphicsContext(); // Draw a rectangle. @@ -5282,7 +5282,7 @@
An ECMAScript implementation would restrict the strings that can be assigned to the type property or passed to the initializeMeal function to those identified in the enumeration.
-var meal = getMeal(); // Get an instance of Meal. +var meal = getMeal(); // Get an instance of Meal. meal.initialize("rice", 200); // Operation invoked as normal. @@ -5327,7 +5327,7 @@
In the ECMAScript language binding, a
-Function object is passed as the operation argument.var ops = getAsyncOperations(); // Get an instance of AsyncOperations. +var ops = getAsyncOperations(); // Get an instance of AsyncOperations. ops.performOperation(function(status) { window.alert("Operation finished, status is " + status + "."); @@ -5467,7 +5467,7 @@
An ECMAScript implementation would thus have an “addEventListener” property in the prototype chain of every
-Entry
:var e = getEntry(); // Obtain an instance of Entry. +var e = getEntry(); // Obtain an instance of Entry. typeof e.addEventListener; // Evaluates to "function".Note that it is not the case that all
@@ -6362,10 +6362,10 @@Observable
objects implementEntry
.initial objects, which the following HTML document demonstrates: -
<!DOCTYPE html> -<title>Different global environments</title> -<iframe id=a></iframe> -<script> +<!DOCTYPE html> +<title>Different global environments</title> +<iframe id=a></iframe> +<script> var iframe = document.getElementById("a"); var w = iframe.contentWindow; // The global object in the frame @@ -6375,7 +6375,7 @@+</script>iframe instanceof w.Object; // Evaluates to false iframe.appendChild instanceof Function; // Evaluates to true iframe.appendChild instanceof w.Function; // Evaluates to false -</script>
Unless otherwise specified, each ECMAScript global environment exposes all interfaces that the implementation supports. If a given ECMAScript global environment does not expose an interface, then the requirements given in §4.6 Interfaces are @@ -7368,7 +7368,7 @@
// Obtain an instance of Canvas. Assume that getSupportedImageCodecs() +
// Obtain an instance of Canvas. Assume that getSupportedImageCodecs() // returns a sequence with two DOMString values: "image/png" and "image/svg+xml". var canvas = getCanvas(); @@ -7825,7 +7825,7 @@octet are clamped to the range [0, 255]. -
// Get an instance of GraphicsContext. +// Get an instance of GraphicsContext. var context = getGraphicsContext(); // Calling the non-[Clamp] version uses ToUint8 to coerce the Numbers to octets. @@ -7885,7 +7885,7 @@NodeList interface object would not have a [[Construct]] property. -
var x = new Circle(); // The uses the zero-argument constructor to create a +var x = new Circle(); // The uses the zero-argument constructor to create a // reference to a platform object that implements the // Circle interface. @@ -7926,7 +7926,7 @@octet will result in an exception being thrown. -
// Get an instance of GraphicsContext. +// Get an instance of GraphicsContext. var context = getGraphicsContext(); // Calling the non-[EnforceRange] version uses ToUint8 to coerce the Numbers to octets. @@ -8107,7 +8107,7 @@var indexedDB = window.indexedDB || window.webkitIndexedDB || +
var indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB || window.msIndexedDB; var requestAnimationFrame = window.requestAnimationFrame || @@ -8196,29 +8196,29 @@Window object can be shadowed, and how the property for an attribute will not be replaced when declaring a variable of the same name: -
<!DOCTYPE html> -<title>Variable declarations and assignments on Window</title> -<iframe name=abc></iframe> +<!DOCTYPE html> +<title>Variable declarations and assignments on Window</title> +<iframe name=abc></iframe> <!-- Shadowing named properties --> -<script> +<script> window.abc; // Evaluates to the iframe’s Window object. abc = 1; // Shadows the named property. window.abc; // Evaluates to 1. -</script> +</script> <!-- Preserving properties for IDL attributes --> -<script> +<script> Window.prototype.def = 2; // Places a property on the prototype. window.hasOwnProperty("length"); // Evaluates to true. length; // Evaluates to 1. def; // Evaluates to 2. -</script> -<script> +</script> +<script> var length; // Variable declaration leaves existing property. length; // Evaluates to 1. var def; // Variable declaration creates shadowing property. def; // Evaluates to undefined. -</script>+</script>4.3.6. [LegacyArrayClass]
If the [
LegacyArrayClass
] extended attribute appears on an interface that is not defined to inherit from another, it indicates that the internal [[Prototype]] @@ -8255,7 +8255,7 @@var list = getItemList(); // Obtain an instance of ItemList. +
var list = getItemList(); // Obtain an instance of ItemList. list.concat(); // Clone the ItemList into an Array. list.pop(); // Remove an item from the ItemList. @@ -8318,7 +8318,7 @@"use strict"; +
"use strict"; var example = getExample(); // Get an instance of Example. @@ -8355,7 +8355,7 @@Example object. -
var example = getExample(); // Get an instance of Example. +var example = getExample(); // Get an instance of Example. var obj = { }; // Fine. @@ -8408,7 +8408,7 @@HTMLAudioElement objects using the
Audio
constructor. -typeof Audio; // Evaluates to 'function'. +typeof Audio; // Evaluates to 'function'. var a1 = new Audio(); // Creates a new object that implements // HTMLAudioElement, using the zero-argument @@ -8482,7 +8482,7 @@Storage’s prototype, but not
Query
’s. -typeof Storage; // evaluates to "object" +typeof Storage; // evaluates to "object" // Add some tracing alert() call to Storage.addEntry. var fn = Storage.prototype.addEntry; @@ -8533,7 +8533,7 @@// Obtain an instance of StringMap. Assume that it has "abc", "length" and +
// Obtain an instance of StringMap. Assume that it has "abc", "length" and // "toString" as supported property names. var map1 = getStringMap(); @@ -8628,7 +8628,7 @@var p = getPerson(); // Obtain an instance of Person. +
var p = getPerson(); // Obtain an instance of Person. p.name = 'John Citizen'; // This statement... p.name.full = 'John Citizen'; // ...has the same behavior as this one.@@ -8667,7 +8667,7 @@platform object implementing
Counter
will shadow the property that corresponds to the attribute: -var counter = getCounter(); // Obtain an instance of Counter. +var counter = getCounter(); // Obtain an instance of Counter. counter.value; // Evaluates to 0. counter.hasOwnProperty("value"); // Evaluates to false. @@ -8811,7 +8811,7 @@var manager = getManager(); // Get an instance of Manager. +
var manager = getManager(); // Get an instance of Manager. manager.handler1 = function() { }; manager.handler1; // Evaluates to the function. @@ -8868,7 +8868,7 @@: -
var d = getDog(); // Assume d is a platform object implementing the Dog +var d = getDog(); // Assume d is a platform object implementing the Dog // interface. d.name = null; // This assigns the string "null" to the .name @@ -8965,7 +8965,7 @@var system = getSystem(); // Get an instance of System. +
var system = getSystem(); // Get an instance of System. system.hasOwnProperty("username"); // Evaluates to true. system.hasOwnProperty("loginTime"); // Evaluates to false. @@ -9008,7 +9008,7 @@var thing = getThing(); // An instance of Thing +
var thing = getThing(); // An instance of Thing with (thing) { f; // Evaluates to a Function object. g; // Throws a ReferenceError. @@ -11426,17 +11426,13 @@OverrideBuiltins] extended attribute was used. The algorithm operates as follows, with property name P and object O:
-
- -
If P is an unforgeable property name on O, then return false.
-- -
If O implements an interface with -an [
Unforgeable
]-annotated attribute whose identifier is P, then return false.If P is not a supported property name of O, then return false.
-- -
If O implements an interface that has the [
OverrideBuiltins
] extended attribute, then return true.If O has an own property named P, then return false.
+Note: This will include cases in which O has unforgeable properties, because in practice those are always set up before objects have any supported property names, and once set up will make the corresponding named properties invisible.
+- +
If O implements an interface that has the [
OverrideBuiltins
] extended attribute, then return true.Initialize prototype to be the value of the internal [[Prototype]] property of O.
- @@ -11457,22 +11453,18 @@
Indexed properties.
- -
Unforgeable attributes and operations.
+Own properties, including unforgeable attributes and operations.
Then, if [
OverrideBuiltins
]:
Named properties.
-- -
Own properties.
Properties from the prototype chain.
Otherwise, if not [
OverrideBuiltins
]:-
- -
Own properties.
Properties from the prototype chain.
- @@ -11501,7 +11493,7 @@
Let value be an uninitialized variable.
- -
If operation was defined without an identifier, then +
If operation was defined without an identifier, then set value to the result of performing the steps listed in the interface description to determine the value of an indexed property with index as the index.
Otherwise, operation was defined with an identifier. Set value to the result @@ -11522,7 +11514,7 @@
If O supports named properties, O does not -implement an interface with the [
Global
] or [PrimaryGlobal
] extended attribute, the result of running the named property visibility algorithm with +implement an interface with the [Global
] or [PrimaryGlobal
] extended attribute, the result of running the named property visibility algorithm with property name P and object O is true, and ignoreNamedProps is false, then:
- @@ -11530,7 +11522,7 @@
Let value be an uninitialized variable.
- -
If operation was defined without an identifier, then +
If operation was defined without an identifier, then set value to the result of performing the steps listed in the interface description to determine the value of a named property with P as the name.
Otherwise, operation was defined with an identifier. Set value to the result @@ -11555,7 +11547,7 @@
Return OrdinaryGetOwnProperty(O, P).
4.8.3. Platform object [[GetOwnProperty]] method
-The internal [[GetOwnProperty]] method of every platform object O that implements an interface which supports indexed or named properties must behave as follows when called with property name P:
+The internal [[GetOwnProperty]] method of every platform object O that implements an interface which supports indexed or named properties must behave as follows when called with property name P:
Return the result of invoking the PlatformObjectGetOwnProperty abstract operation with O, P, and
false as @@ -11575,7 +11567,7 @@
Let value be the result of converting V to an IDL value of type T.
- -
If operation was defined without an identifier, then:
+If operation was defined without an identifier, then:
If creating is true, then perform the steps listed in the interface description to set the value of a new indexed property with index as the index and value as the value.
@@ -11597,7 +11589,7 @@
Let value be the result of converting V to an IDL value of type T.
- -
If operation was defined without an identifier, then:
+If operation was defined without an identifier, then:
If creating is true, then perform the steps listed in the interface description to set the value of a new named property with P as the name and value as the value.
@@ -11608,7 +11600,7 @@Otherwise, operation was defined with an identifier. Perform the steps listed in the description of operation with index and value as the two argument values.
4.8.6. Platform object [[Set]] method
-The internal [[Set]] method of every platform object O that implements an interface which supports indexed or named properties must behave as follows when called +
The internal [[Set]] method of every platform object O that implements an interface which supports indexed or named properties must behave as follows when called with property name P, value V, and ECMAScript language value Receiver:
@@ -11643,7 +11635,7 @@
4.8.7. Platform object [[DefineOwnProperty]] method
When the internal [[DefineOwnProperty]] method of a platform object O that -implements an interface which supports indexed or named properties is +implements an interface which supports indexed or named properties is called with property key P and Property Descriptor Desc, the following steps must be taken:
- @@ -11659,8 +11651,8 @@
Return
true .- -
If O supports named properties, O does not implement an interface with the -[
+Global
] or [PrimaryGlobal
] extended attribute and P is not an unforgeable property name of O, then:If O supports named properties, O does not implement an interface with the +[
Global
] or [PrimaryGlobal
] extended attribute and P is not an unforgeable property name of O, then:
Let creating be true if P is not a supported property name, and false otherwise.
@@ -11684,14 +11676,14 @@
- -
If O does not implement an interface with the +
If O does not implement an interface with the [
Global
] or [PrimaryGlobal
] extended attribute, then set Desc.[[Configurable]] totrue .Return OrdinaryDefineOwnProperty(O, P, Desc).
4.8.8. Platform object [[Delete]] method
-The internal [[Delete]] method of every platform object O that implements an interface which supports indexed or named properties must behave as follows when called with property name P.
+The internal [[Delete]] method of every platform object O that implements an interface which supports indexed or named properties must behave as follows when called with property name P.
If O supports indexed properties and P is an array index property name, then:
@@ -11704,7 +11696,7 @@4
Return
false .- -
If O supports named properties, O does not implement an interface with the +
If O supports named properties, O does not implement an interface with the [
Global
] or [PrimaryGlobal
] extended attribute and the result of calling the named property visibility algorithm with property name P and object O is true, then:
- @@ -11712,7 +11704,7 @@
4
Let operation be the operation used to declare the named property deleter.
- -
If operation was defined without an identifier, then:
+If operation was defined without an identifier, then:
Perform the steps listed in the interface description to delete an existing named property with P as the name.
@@ -11742,7 +11734,7 @@4
Return
true .4.8.9. Platform object [[Call]] method
-The internal [[Call]] method of every platform object O that implements an interface I with at least one legacy caller must behave as follows, assuming arg0..n−1 is the list of argument +
The internal [[Call]] method of every platform object O that implements an interface I with at least one legacy caller must behave as follows, assuming arg0..n−1 is the list of argument values passed to [[Call]]:
- @@ -11756,7 +11748,7 @@
4.8
4.8.10. Property enumeration
This document does not define a complete property enumeration order -for all platform objects implementing interfaces (or for platform objects representing exceptions). +for all platform objects implementing interfaces (or for platform objects representing exceptions). However, if a platform object implements an interface that supports indexed or named properties, then properties on the object must be enumerated in the following order:
@@ -11766,7 +11758,7 @@supported property indices are enumerated first, in numerical order.
- -
If the object supports named properties and doesn’t implement an interface with the +
If the object supports named properties and doesn’t implement an interface with the [
@@ -11794,17 +11786,17 @@LegacyUnenumerableNamedProperties
] extended attribute, then the object’s supported property names that are visible according to the named property visibility algorithm are enumerated next, in the order given in the definition of the set of supported property names.callable. The implementation of the operation (or set of overloaded operations) is the result of invoking the internal [[Get]] method -on the object with a property name that is the identifier of the operation. +on the object with a property name that is the identifier of the operation.
Otherwise, the interface is not a single operation callback interface. Any object that is not a native
RegExp object is considered to implement the interface. -For each operation declared on the interface with a given identifier, the implementation +For each operation declared on the interface with a given identifier, the implementation is the result of invoking [[Get]] on the object with a property name that is that identifier.Note that ECMAScript objects need not have -properties corresponding to constants on them to be considered as user objects implementing interfaces that happen +properties corresponding to constants on them to be considered as user objects implementing interfaces that happen to have constants declared on them.
A single operation callback interface is a callback interface that:
@@ -11812,9 +11804,9 @@
is not declared to inherit from another interface,
- -
has no attributes, and
+has no attributes, and
- -
has one or more regular operations that all have the same identifier, +
has one or more regular operations that all have the same identifier, and no others.
To call a user object’s operation, given a callback interface type value value, sometimes-optional operation name opName, @@ -12102,7 +12094,7 @@
4.11. Namespaces
For every namespace that is exposed in a given ECMAScript global environment, a corresponding property must exist on the ECMAScript -environment’s global object. The name of the property is the identifier of the namespace, and its value is an object +environment’s global object. The name of the property is the identifier of the namespace, and its value is an object called the namespace object.
The property has the attributes { [[Writable]]:
true , [[Enumerable]]:false , [[Configurable]]:true }. The characteristics of a @@ -12119,7 +12111,7 @@
Let F be the result of creating an operation function given op, namespace, and realm.
- -
Perform ! CreateDataProperty(namespaceObject, op’s identifier, F).
+Perform ! CreateDataProperty(namespaceObject, op’s identifier, F).
4.12. Exceptions
@@ -12208,10 +12200,10 @@
Let F be the
+on the ECMAScript call stack where F corresponds to an IDL attribute, operation, indexed property, named property, constructor, named constructor or stringifier.Function object used as thethis value in the top-most call -on the ECMAScript call stack where F corresponds to an IDL attribute, operation, indexed property, named property, constructor, named constructor or stringifier.If F corresponds to an attribute, operation or stringifier, then return -the global environment associated with the interface that definition appears on.
+the global environment associated with the interface that definition appears on.Otherwise, if F corresponds to an indexed or named property, then return the global environment associated with the interface that @@ -12303,7 +12295,7 @@
MathUtils object from a different global environment to doComputation, then the exception thrown will be from that global environment: -
var a = getA(); // An A object from this global environment. +var a = getA(); // An A object from this global environment. var m = otherWindow.getMathUtils(); // A MathUtils object from a different global environment. a instanceof Object; // Evaluates to true. @@ -12328,7 +12320,7 @@
-@@ -6362,10 +6362,10 @@The following IDL fragment defines two interfaces and an exception. +
The following IDL fragment defines two interfaces and an exception. The
valueOf
attribute onExceptionThrower
is defined to throw an exception whenever an attempt is made to get its value.interface Dahut { @@ -12342,7 +12334,7 @@
Assuming an ECMAScript implementation supporting this interface, the following code demonstrates how exceptions are handled:
-var d = getDahut(); // Obtain an instance of Dahut. +var d = getDahut(); // Obtain an instance of Dahut. var et = getExceptionThrower(); // Obtain an instance of ExceptionThrower. try { @@ -12558,7 +12550,7 @@IDL gr used in the grammar and the values used for
identifier terminals. Thus, for example, the input text “Const” is tokenized as anidentifier rather than the -terminal symbolconst , an interface with identifier “A” is distinct from one named “a”, and an extended attribute [constructor
] will not be recognized as +terminal symbolconst , an interface with identifier “A” is distinct from one named “a”, and an extended attribute [constructor
] will not be recognized as the [Constructor
] extended attribute.Implicitly, any number of
whitespace andcomment terminals are allowed between every other terminal @@ -13032,6 +13024,7 @@[HTML] defines the following terms:
+
- Window
- clean up after running a callback
- clean up after running script
- event handler idl attributes @@ -13044,19 +13037,14 @@
settings object
- - [UNICODE] defines the following terms: - -
- - [HTML] defines the following terms: + [secure-contexts] defines the following terms:
-
- Window +
- secure context
- - [secure-contexts] defines the following terms: + [UNICODE] defines the following terms:
References
@@ -13222,15 +13210,14 @@I
- 4.6.9.4. Default iterator objects
- 4.6.9.5. Iterator prototype object
- 4.8. Platform objects implementing interfaces -
- 4.8.1. Indexed and named properties -
- 4.8.2. The PlatformObjectGetOwnProperty abstract operation (2) -
- 4.8.4. Invoking a platform object indexed property setter -
- 4.8.5. Invoking a platform object named property setter -
- 4.8.8. Platform object [[Delete]] method -
- 4.9. User objects implementing callback interfaces (2) (3) -
- 4.11. Namespaces -
- 4.11.1. Namespace object -
- IDL grammar +
- 4.8.2. The PlatformObjectGetOwnProperty abstract operation (2) +
- 4.8.4. Invoking a platform object indexed property setter +
- 4.8.5. Invoking a platform object named property setter +
- 4.8.8. Platform object [[Delete]] method +
- 4.9. User objects implementing callback interfaces (2) (3) +
- 4.11. Namespaces +
- 4.11.1. Namespace object +
- IDL grammar
initial objects, which the following HTML document demonstrates: -
<!DOCTYPE html> -<title>Different global environments</title> -<iframe id=a></iframe> -<script> +<!DOCTYPE html> +<title>Different global environments</title> +<iframe id=a></iframe> +<script> var iframe = document.getElementById("a"); var w = iframe.contentWindow; // The global object in the frame @@ -6375,7 +6375,7 @@+</script>iframe instanceof w.Object; // Evaluates to false iframe.appendChild instanceof Function; // Evaluates to true iframe.appendChild instanceof w.Function; // Evaluates to false -</script>
Unless otherwise specified, each ECMAScript global environment exposes all interfaces that the implementation supports. If a given ECMAScript global environment does not expose an interface, then the requirements given in §4.6 Interfaces are @@ -7368,7 +7368,7 @@
// Obtain an instance of Canvas. Assume that getSupportedImageCodecs() +
// Obtain an instance of Canvas. Assume that getSupportedImageCodecs() // returns a sequence with two DOMString values: "image/png" and "image/svg+xml". var canvas = getCanvas(); @@ -7825,7 +7825,7 @@octet are clamped to the range [0, 255]. -
// Get an instance of GraphicsContext. +// Get an instance of GraphicsContext. var context = getGraphicsContext(); // Calling the non-[Clamp] version uses ToUint8 to coerce the Numbers to octets. @@ -7885,7 +7885,7 @@NodeList interface object would not have a [[Construct]] property. -
var x = new Circle(); // The uses the zero-argument constructor to create a +var x = new Circle(); // The uses the zero-argument constructor to create a // reference to a platform object that implements the // Circle interface. @@ -7926,7 +7926,7 @@octet will result in an exception being thrown. -
// Get an instance of GraphicsContext. +// Get an instance of GraphicsContext. var context = getGraphicsContext(); // Calling the non-[EnforceRange] version uses ToUint8 to coerce the Numbers to octets. @@ -8107,7 +8107,7 @@var indexedDB = window.indexedDB || window.webkitIndexedDB || +
var indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB || window.msIndexedDB; var requestAnimationFrame = window.requestAnimationFrame || @@ -8196,29 +8196,29 @@Window object can be shadowed, and how the property for an attribute will not be replaced when declaring a variable of the same name: -
<!DOCTYPE html> -<title>Variable declarations and assignments on Window</title> -<iframe name=abc></iframe> +<!DOCTYPE html> +<title>Variable declarations and assignments on Window</title> +<iframe name=abc></iframe> <!-- Shadowing named properties --> -<script> +<script> window.abc; // Evaluates to the iframe’s Window object. abc = 1; // Shadows the named property. window.abc; // Evaluates to 1. -</script> +</script> <!-- Preserving properties for IDL attributes --> -<script> +<script> Window.prototype.def = 2; // Places a property on the prototype. window.hasOwnProperty("length"); // Evaluates to true. length; // Evaluates to 1. def; // Evaluates to 2. -</script> -<script> +</script> +<script> var length; // Variable declaration leaves existing property. length; // Evaluates to 1. var def; // Variable declaration creates shadowing property. def; // Evaluates to undefined. -</script>+</script>4.3.6. [LegacyArrayClass]
If the [
LegacyArrayClass
] extended attribute appears on an interface that is not defined to inherit from another, it indicates that the internal [[Prototype]] @@ -8255,7 +8255,7 @@var list = getItemList(); // Obtain an instance of ItemList. +
var list = getItemList(); // Obtain an instance of ItemList. list.concat(); // Clone the ItemList into an Array. list.pop(); // Remove an item from the ItemList. @@ -8318,7 +8318,7 @@"use strict"; +
"use strict"; var example = getExample(); // Get an instance of Example. @@ -8355,7 +8355,7 @@Example object. -
var example = getExample(); // Get an instance of Example. +var example = getExample(); // Get an instance of Example. var obj = { }; // Fine. @@ -8408,7 +8408,7 @@HTMLAudioElement objects using the
Audio
constructor. -typeof Audio; // Evaluates to 'function'. +typeof Audio; // Evaluates to 'function'. var a1 = new Audio(); // Creates a new object that implements // HTMLAudioElement, using the zero-argument @@ -8482,7 +8482,7 @@Storage’s prototype, but not
Query
’s. -typeof Storage; // evaluates to "object" +typeof Storage; // evaluates to "object" // Add some tracing alert() call to Storage.addEntry. var fn = Storage.prototype.addEntry; @@ -8533,7 +8533,7 @@// Obtain an instance of StringMap. Assume that it has "abc", "length" and +
// Obtain an instance of StringMap. Assume that it has "abc", "length" and // "toString" as supported property names. var map1 = getStringMap(); @@ -8628,7 +8628,7 @@var p = getPerson(); // Obtain an instance of Person. +
var p = getPerson(); // Obtain an instance of Person. p.name = 'John Citizen'; // This statement... p.name.full = 'John Citizen'; // ...has the same behavior as this one.@@ -8667,7 +8667,7 @@platform object implementing
Counter
will shadow the property that corresponds to the attribute: -var counter = getCounter(); // Obtain an instance of Counter. +var counter = getCounter(); // Obtain an instance of Counter. counter.value; // Evaluates to 0. counter.hasOwnProperty("value"); // Evaluates to false. @@ -8811,7 +8811,7 @@var manager = getManager(); // Get an instance of Manager. +
var manager = getManager(); // Get an instance of Manager. manager.handler1 = function() { }; manager.handler1; // Evaluates to the function. @@ -8868,7 +8868,7 @@: -
var d = getDog(); // Assume d is a platform object implementing the Dog +var d = getDog(); // Assume d is a platform object implementing the Dog // interface. d.name = null; // This assigns the string "null" to the .name @@ -8965,7 +8965,7 @@var system = getSystem(); // Get an instance of System. +
var system = getSystem(); // Get an instance of System. system.hasOwnProperty("username"); // Evaluates to true. system.hasOwnProperty("loginTime"); // Evaluates to false. @@ -9008,7 +9008,7 @@var thing = getThing(); // An instance of Thing +
var thing = getThing(); // An instance of Thing with (thing) { f; // Evaluates to a Function object. g; // Throws a ReferenceError. @@ -12295,7 +12295,7 @@MathUtils object from a different global environment to doComputation, then the exception thrown will be from that global environment: -
var a = getA(); // An A object from this global environment. +var a = getA(); // An A object from this global environment. var m = otherWindow.getMathUtils(); // A MathUtils object from a different global environment. a instanceof Object; // Evaluates to true. @@ -12334,7 +12334,7 @@
Assuming an ECMAScript implementation supporting this interface, the following code demonstrates how exceptions are handled:
-var d = getDahut(); // Obtain an instance of Dahut. +var d = getDahut(); // Obtain an instance of Dahut. var et = getExceptionThrower(); // Obtain an instance of ExceptionThrower. try {