@@ -5,12 +5,11 @@ stuff in JavaScript which have a `DontDelete` attribute set.
5
5
6
6
### Global code and Function code
7
7
8
- When a variable or a function is defined in a global
9
- or a [ function scope] ( #function.scopes ) it is a property of either
10
- Activation object or Global object. Such properties have a set of attributes,
11
- one of these is ` DontDelete ` . Variable and function declarations in global
12
- and function code always create properties with ` DontDelete ` , therefore
13
- cannot be deleted.
8
+ When a variable or a function is defined in a global or a [ function
9
+ scope] ( #function.scopes ) it is a property of either the Activation object or
10
+ the Global object. Such properties have a set of attributes, one of which is
11
+ ` DontDelete ` . Variable and function declarations in global and function code
12
+ always create properties with ` DontDelete ` , and therefore cannot be deleted.
14
13
15
14
// global variable:
16
15
var a = 1; // DontDelete is set
@@ -29,8 +28,7 @@ cannot be deleted.
29
28
30
29
### Explicit properties
31
30
32
- There are things which can be deleted normally: these are explicitly set
33
- properties.
31
+ Explicitly set properties can be deleted normally.
34
32
35
33
// explicitly set property:
36
34
var obj = {x: 1};
@@ -40,8 +38,8 @@ properties.
40
38
obj.x; // undefined
41
39
obj.y; // undefined
42
40
43
- In the example above ` obj.x ` and ` obj.y ` can be deleted because they have no
44
- ` DontDelete ` atribute. That's why an example below works too.
41
+ In the example above, ` obj.x ` and ` obj.y ` can be deleted because they have no
42
+ ` DontDelete ` atribute. That's why the example below works too.
45
43
46
44
// this works fine, except for IE:
47
45
var GLOBAL_OBJECT = this;
@@ -58,7 +56,7 @@ IE (at least 6-8) has some bugs, so the code above doesn't work.
58
56
59
57
### Function arguments and built-ins
60
58
61
- Functions' normal arguments, [ ` arguments ` object ] ( #function.arguments )
59
+ Functions' normal arguments, [ ` arguments ` objects ] ( #function.arguments )
62
60
and built-in properties also have ` DontDelete ` set.
63
61
64
62
// function arguments and properties:
@@ -78,10 +76,10 @@ and built-in properties also have `DontDelete` set.
78
76
79
77
### Host objects
80
78
81
- Behaviour of ` delete ` operator can be unpredictable for hosted objects. Due to
82
- specification, host objects are allowed to implement any kind of behavior.
79
+ The behaviour of ` delete ` operator can be unpredictable for hosted objects. Due
80
+ to the specification, host objects are allowed to implement any kind of behavior.
83
81
84
82
### In conclusion
85
83
86
- ` delete ` operator often has an unexpected behaviour and can be safely used
87
- only for dealing with explicitly set properties on normal objects.
84
+ The ` delete ` operator often has unexpected behaviour and can only be safely
85
+ used to delete explicitly set properties on normal objects.
0 commit comments