es5-shim-rails 2.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +48 -0
- data/Rakefile +1 -0
- data/es5-shim-rails.gemspec +19 -0
- data/lib/es5-shim-rails.rb +10 -0
- data/lib/es5-shim-rails/version.rb +7 -0
- data/vendor/assets/javascripts/es5-shim/es5-sham-min.js +1 -0
- data/vendor/assets/javascripts/es5-shim/es5-sham.js +1 -0
- data/vendor/assets/javascripts/es5-shim/es5-shim-min.js +1 -0
- data/vendor/assets/javascripts/es5-shim/es5-shim.js +1 -0
- data/vendor/assets/javascripts/es5-shim/shims/es5-sham.js +386 -0
- data/vendor/assets/javascripts/es5-shim/shims/es5-sham.min.js +7 -0
- data/vendor/assets/javascripts/es5-shim/shims/es5-shim.js +981 -0
- data/vendor/assets/javascripts/es5-shim/shims/es5-shim.min.js +17 -0
- metadata +61 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Yousef Ourabi
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# es5-shim asset gem for Rails
|
2
|
+
|
3
|
+
This asset gem packages [es5-shim](https://github.com/kriskowal/es5-shim) for the Rails asset pipeline.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'es5-shim-rails'
|
10
|
+
|
11
|
+
or
|
12
|
+
|
13
|
+
gem 'es5-shim-rails', :git => "git@github.com:yourabi/es5-shim-rails.git"
|
14
|
+
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
$ bundle
|
19
|
+
|
20
|
+
Or install it yourself as:
|
21
|
+
|
22
|
+
$ gem install es5-shim-rails
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
To use es5-shim in your rails app enable it via the asset pipeline (app/assets/javascripts/application.js).
|
27
|
+
|
28
|
+
Add one of the folllwing lines to your application.js manifest:
|
29
|
+
|
30
|
+
```js
|
31
|
+
|
32
|
+
//= require es5-shim/es5-shim
|
33
|
+
//= require es5-shim/es5-shim-min
|
34
|
+
|
35
|
+
//= require es5-shim/es5-sham
|
36
|
+
//= require es5-shim/es5-sham-min
|
37
|
+
|
38
|
+
```
|
39
|
+
|
40
|
+
Currently this version tracks es5-shim 2.0.5 [commit 6221329363](https://github.com/msievers/es5-shim-rails/commit/62213293633462d04770e658c6e8e4427c67d96a).
|
41
|
+
|
42
|
+
## Contributing
|
43
|
+
|
44
|
+
1. Fork it
|
45
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
46
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
47
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
48
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'es5-shim-rails/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "es5-shim-rails"
|
8
|
+
gem.version = Es5::Shim::Rails::VERSION
|
9
|
+
gem.authors = ["Yousef Ourabi"]
|
10
|
+
gem.email = ["yourabi@gmail.com"]
|
11
|
+
gem.description = %q{Asset gem for es5-shim}
|
12
|
+
gem.summary = %q{Asset gem for es5-shim}
|
13
|
+
gem.homepage = "https://github.com/yourabi/es5-shim-rails"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require es5-shim/shims/es5-sham.min.js
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require es5-shim/shims/es5-sham.js
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require es5-shim/shims/es5-shim.min.js
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require es5-shim/shims/es5-shim.js
|
@@ -0,0 +1,386 @@
|
|
1
|
+
// Copyright 2009-2012 by contributors, MIT License
|
2
|
+
// vim: ts=4 sts=4 sw=4 expandtab
|
3
|
+
|
4
|
+
// Module systems magic dance
|
5
|
+
(function (definition) {
|
6
|
+
// RequireJS
|
7
|
+
if (typeof define == "function") {
|
8
|
+
define(definition);
|
9
|
+
// YUI3
|
10
|
+
} else if (typeof YUI == "function") {
|
11
|
+
YUI.add("es5-sham", definition);
|
12
|
+
// CommonJS and <script>
|
13
|
+
} else {
|
14
|
+
definition();
|
15
|
+
}
|
16
|
+
})(function () {
|
17
|
+
|
18
|
+
// ES5 15.2.3.2
|
19
|
+
// http://es5.github.com/#x15.2.3.2
|
20
|
+
if (!Object.getPrototypeOf) {
|
21
|
+
// https://github.com/kriskowal/es5-shim/issues#issue/2
|
22
|
+
// http://ejohn.org/blog/objectgetprototypeof/
|
23
|
+
// recommended by fschaefer on github
|
24
|
+
Object.getPrototypeOf = function getPrototypeOf(object) {
|
25
|
+
return object.__proto__ || (
|
26
|
+
object.constructor
|
27
|
+
? object.constructor.prototype
|
28
|
+
: prototypeOfObject
|
29
|
+
);
|
30
|
+
};
|
31
|
+
}
|
32
|
+
|
33
|
+
// ES5 15.2.3.3
|
34
|
+
// http://es5.github.com/#x15.2.3.3
|
35
|
+
if (!Object.getOwnPropertyDescriptor) {
|
36
|
+
var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a non-object: ";
|
37
|
+
|
38
|
+
Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {
|
39
|
+
if ((typeof object != "object" && typeof object != "function") || object === null) {
|
40
|
+
throw new TypeError(ERR_NON_OBJECT + object);
|
41
|
+
}
|
42
|
+
// If object does not owns property return undefined immediately.
|
43
|
+
if (!owns(object, property)) {
|
44
|
+
return;
|
45
|
+
}
|
46
|
+
|
47
|
+
// If object has a property then it's for sure both `enumerable` and
|
48
|
+
// `configurable`.
|
49
|
+
var descriptor = { enumerable: true, configurable: true };
|
50
|
+
|
51
|
+
// If JS engine supports accessor properties then property may be a
|
52
|
+
// getter or setter.
|
53
|
+
if (supportsAccessors) {
|
54
|
+
// Unfortunately `__lookupGetter__` will return a getter even
|
55
|
+
// if object has own non getter property along with a same named
|
56
|
+
// inherited getter. To avoid misbehavior we temporary remove
|
57
|
+
// `__proto__` so that `__lookupGetter__` will return getter only
|
58
|
+
// if it's owned by an object.
|
59
|
+
var prototype = object.__proto__;
|
60
|
+
object.__proto__ = prototypeOfObject;
|
61
|
+
|
62
|
+
var getter = lookupGetter(object, property);
|
63
|
+
var setter = lookupSetter(object, property);
|
64
|
+
|
65
|
+
// Once we have getter and setter we can put values back.
|
66
|
+
object.__proto__ = prototype;
|
67
|
+
|
68
|
+
if (getter || setter) {
|
69
|
+
if (getter) {
|
70
|
+
descriptor.get = getter;
|
71
|
+
}
|
72
|
+
if (setter) {
|
73
|
+
descriptor.set = setter;
|
74
|
+
}
|
75
|
+
// If it was accessor property we're done and return here
|
76
|
+
// in order to avoid adding `value` to the descriptor.
|
77
|
+
return descriptor;
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
// If we got this far we know that object has an own property that is
|
82
|
+
// not an accessor so we set it as a value and return descriptor.
|
83
|
+
descriptor.value = object[property];
|
84
|
+
return descriptor;
|
85
|
+
};
|
86
|
+
}
|
87
|
+
|
88
|
+
// ES5 15.2.3.4
|
89
|
+
// http://es5.github.com/#x15.2.3.4
|
90
|
+
if (!Object.getOwnPropertyNames) {
|
91
|
+
Object.getOwnPropertyNames = function getOwnPropertyNames(object) {
|
92
|
+
return Object.keys(object);
|
93
|
+
};
|
94
|
+
}
|
95
|
+
|
96
|
+
// ES5 15.2.3.5
|
97
|
+
// http://es5.github.com/#x15.2.3.5
|
98
|
+
if (!Object.create) {
|
99
|
+
|
100
|
+
// Contributed by Brandon Benvie, October, 2012
|
101
|
+
var createEmpty;
|
102
|
+
var supportsProto = Object.prototype.__proto__ === null;
|
103
|
+
if (supportsProto || typeof document == 'undefined') {
|
104
|
+
createEmpty = function () {
|
105
|
+
return { "__proto__": null };
|
106
|
+
};
|
107
|
+
} else {
|
108
|
+
// In old IE __proto__ can't be used to manually set `null`, nor does
|
109
|
+
// any other method exist to make an object that inherits from nothing,
|
110
|
+
// aside from Object.prototype itself. Instead, create a new global
|
111
|
+
// object and *steal* its Object.prototype and strip it bare. This is
|
112
|
+
// used as the prototype to create nullary objects.
|
113
|
+
createEmpty = (function () {
|
114
|
+
var iframe = document.createElement('iframe');
|
115
|
+
var parent = document.body || document.documentElement;
|
116
|
+
iframe.style.display = 'none';
|
117
|
+
parent.appendChild(iframe);
|
118
|
+
iframe.src = 'javascript:';
|
119
|
+
var empty = iframe.contentWindow.Object.prototype;
|
120
|
+
parent.removeChild(iframe);
|
121
|
+
iframe = null;
|
122
|
+
delete empty.constructor;
|
123
|
+
delete empty.hasOwnProperty;
|
124
|
+
delete empty.propertyIsEnumerable;
|
125
|
+
delete empty.isPrototypeOf;
|
126
|
+
delete empty.toLocaleString;
|
127
|
+
delete empty.toString;
|
128
|
+
delete empty.valueOf;
|
129
|
+
empty.__proto__ = null;
|
130
|
+
|
131
|
+
function Empty() {}
|
132
|
+
Empty.prototype = empty;
|
133
|
+
|
134
|
+
return function () {
|
135
|
+
return new Empty();
|
136
|
+
};
|
137
|
+
})();
|
138
|
+
}
|
139
|
+
|
140
|
+
Object.create = function create(prototype, properties) {
|
141
|
+
|
142
|
+
var object;
|
143
|
+
function Type() {} // An empty constructor.
|
144
|
+
|
145
|
+
if (prototype === null) {
|
146
|
+
object = createEmpty();
|
147
|
+
} else {
|
148
|
+
if (typeof prototype !== "object" && typeof prototype !== "function") {
|
149
|
+
// In the native implementation `parent` can be `null`
|
150
|
+
// OR *any* `instanceof Object` (Object|Function|Array|RegExp|etc)
|
151
|
+
// Use `typeof` tho, b/c in old IE, DOM elements are not `instanceof Object`
|
152
|
+
// like they are in modern browsers. Using `Object.create` on DOM elements
|
153
|
+
// is...err...probably inappropriate, but the native version allows for it.
|
154
|
+
throw new TypeError("Object prototype may only be an Object or null"); // same msg as Chrome
|
155
|
+
}
|
156
|
+
Type.prototype = prototype;
|
157
|
+
object = new Type();
|
158
|
+
// IE has no built-in implementation of `Object.getPrototypeOf`
|
159
|
+
// neither `__proto__`, but this manually setting `__proto__` will
|
160
|
+
// guarantee that `Object.getPrototypeOf` will work as expected with
|
161
|
+
// objects created using `Object.create`
|
162
|
+
object.__proto__ = prototype;
|
163
|
+
}
|
164
|
+
|
165
|
+
if (properties !== void 0) {
|
166
|
+
Object.defineProperties(object, properties);
|
167
|
+
}
|
168
|
+
|
169
|
+
return object;
|
170
|
+
};
|
171
|
+
}
|
172
|
+
|
173
|
+
// ES5 15.2.3.6
|
174
|
+
// http://es5.github.com/#x15.2.3.6
|
175
|
+
|
176
|
+
// Patch for WebKit and IE8 standard mode
|
177
|
+
// Designed by hax <hax.github.com>
|
178
|
+
// related issue: https://github.com/kriskowal/es5-shim/issues#issue/5
|
179
|
+
// IE8 Reference:
|
180
|
+
// http://msdn.microsoft.com/en-us/library/dd282900.aspx
|
181
|
+
// http://msdn.microsoft.com/en-us/library/dd229916.aspx
|
182
|
+
// WebKit Bugs:
|
183
|
+
// https://bugs.webkit.org/show_bug.cgi?id=36423
|
184
|
+
|
185
|
+
function doesDefinePropertyWork(object) {
|
186
|
+
try {
|
187
|
+
Object.defineProperty(object, "sentinel", {});
|
188
|
+
return "sentinel" in object;
|
189
|
+
} catch (exception) {
|
190
|
+
// returns falsy
|
191
|
+
}
|
192
|
+
}
|
193
|
+
|
194
|
+
// check whether defineProperty works if it's given. Otherwise,
|
195
|
+
// shim partially.
|
196
|
+
if (Object.defineProperty) {
|
197
|
+
var definePropertyWorksOnObject = doesDefinePropertyWork({});
|
198
|
+
var definePropertyWorksOnDom = typeof document == "undefined" ||
|
199
|
+
doesDefinePropertyWork(document.createElement("div"));
|
200
|
+
if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) {
|
201
|
+
var definePropertyFallback = Object.defineProperty,
|
202
|
+
definePropertiesFallback = Object.defineProperties;
|
203
|
+
}
|
204
|
+
}
|
205
|
+
|
206
|
+
if (!Object.defineProperty || definePropertyFallback) {
|
207
|
+
var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: ";
|
208
|
+
var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: "
|
209
|
+
var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " +
|
210
|
+
"on this javascript engine";
|
211
|
+
|
212
|
+
Object.defineProperty = function defineProperty(object, property, descriptor) {
|
213
|
+
if ((typeof object != "object" && typeof object != "function") || object === null) {
|
214
|
+
throw new TypeError(ERR_NON_OBJECT_TARGET + object);
|
215
|
+
}
|
216
|
+
if ((typeof descriptor != "object" && typeof descriptor != "function") || descriptor === null) {
|
217
|
+
throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor);
|
218
|
+
}
|
219
|
+
// make a valiant attempt to use the real defineProperty
|
220
|
+
// for I8's DOM elements.
|
221
|
+
if (definePropertyFallback) {
|
222
|
+
try {
|
223
|
+
return definePropertyFallback.call(Object, object, property, descriptor);
|
224
|
+
} catch (exception) {
|
225
|
+
// try the shim if the real one doesn't work
|
226
|
+
}
|
227
|
+
}
|
228
|
+
|
229
|
+
// If it's a data property.
|
230
|
+
if (owns(descriptor, "value")) {
|
231
|
+
// fail silently if "writable", "enumerable", or "configurable"
|
232
|
+
// are requested but not supported
|
233
|
+
/*
|
234
|
+
// alternate approach:
|
235
|
+
if ( // can't implement these features; allow false but not true
|
236
|
+
!(owns(descriptor, "writable") ? descriptor.writable : true) ||
|
237
|
+
!(owns(descriptor, "enumerable") ? descriptor.enumerable : true) ||
|
238
|
+
!(owns(descriptor, "configurable") ? descriptor.configurable : true)
|
239
|
+
)
|
240
|
+
throw new RangeError(
|
241
|
+
"This implementation of Object.defineProperty does not " +
|
242
|
+
"support configurable, enumerable, or writable."
|
243
|
+
);
|
244
|
+
*/
|
245
|
+
|
246
|
+
if (supportsAccessors && (lookupGetter(object, property) ||
|
247
|
+
lookupSetter(object, property)))
|
248
|
+
{
|
249
|
+
// As accessors are supported only on engines implementing
|
250
|
+
// `__proto__` we can safely override `__proto__` while defining
|
251
|
+
// a property to make sure that we don't hit an inherited
|
252
|
+
// accessor.
|
253
|
+
var prototype = object.__proto__;
|
254
|
+
object.__proto__ = prototypeOfObject;
|
255
|
+
// Deleting a property anyway since getter / setter may be
|
256
|
+
// defined on object itself.
|
257
|
+
delete object[property];
|
258
|
+
object[property] = descriptor.value;
|
259
|
+
// Setting original `__proto__` back now.
|
260
|
+
object.__proto__ = prototype;
|
261
|
+
} else {
|
262
|
+
object[property] = descriptor.value;
|
263
|
+
}
|
264
|
+
} else {
|
265
|
+
if (!supportsAccessors) {
|
266
|
+
throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
|
267
|
+
}
|
268
|
+
// If we got that far then getters and setters can be defined !!
|
269
|
+
if (owns(descriptor, "get")) {
|
270
|
+
defineGetter(object, property, descriptor.get);
|
271
|
+
}
|
272
|
+
if (owns(descriptor, "set")) {
|
273
|
+
defineSetter(object, property, descriptor.set);
|
274
|
+
}
|
275
|
+
}
|
276
|
+
return object;
|
277
|
+
};
|
278
|
+
}
|
279
|
+
|
280
|
+
// ES5 15.2.3.7
|
281
|
+
// http://es5.github.com/#x15.2.3.7
|
282
|
+
if (!Object.defineProperties || definePropertiesFallback) {
|
283
|
+
Object.defineProperties = function defineProperties(object, properties) {
|
284
|
+
// make a valiant attempt to use the real defineProperties
|
285
|
+
if (definePropertiesFallback) {
|
286
|
+
try {
|
287
|
+
return definePropertiesFallback.call(Object, object, properties);
|
288
|
+
} catch (exception) {
|
289
|
+
// try the shim if the real one doesn't work
|
290
|
+
}
|
291
|
+
}
|
292
|
+
|
293
|
+
for (var property in properties) {
|
294
|
+
if (owns(properties, property) && property != "__proto__") {
|
295
|
+
Object.defineProperty(object, property, properties[property]);
|
296
|
+
}
|
297
|
+
}
|
298
|
+
return object;
|
299
|
+
};
|
300
|
+
}
|
301
|
+
|
302
|
+
// ES5 15.2.3.8
|
303
|
+
// http://es5.github.com/#x15.2.3.8
|
304
|
+
if (!Object.seal) {
|
305
|
+
Object.seal = function seal(object) {
|
306
|
+
// this is misleading and breaks feature-detection, but
|
307
|
+
// allows "securable" code to "gracefully" degrade to working
|
308
|
+
// but insecure code.
|
309
|
+
return object;
|
310
|
+
};
|
311
|
+
}
|
312
|
+
|
313
|
+
// ES5 15.2.3.9
|
314
|
+
// http://es5.github.com/#x15.2.3.9
|
315
|
+
if (!Object.freeze) {
|
316
|
+
Object.freeze = function freeze(object) {
|
317
|
+
// this is misleading and breaks feature-detection, but
|
318
|
+
// allows "securable" code to "gracefully" degrade to working
|
319
|
+
// but insecure code.
|
320
|
+
return object;
|
321
|
+
};
|
322
|
+
}
|
323
|
+
|
324
|
+
// detect a Rhino bug and patch it
|
325
|
+
try {
|
326
|
+
Object.freeze(function () {});
|
327
|
+
} catch (exception) {
|
328
|
+
Object.freeze = (function freeze(freezeObject) {
|
329
|
+
return function freeze(object) {
|
330
|
+
if (typeof object == "function") {
|
331
|
+
return object;
|
332
|
+
} else {
|
333
|
+
return freezeObject(object);
|
334
|
+
}
|
335
|
+
};
|
336
|
+
})(Object.freeze);
|
337
|
+
}
|
338
|
+
|
339
|
+
// ES5 15.2.3.10
|
340
|
+
// http://es5.github.com/#x15.2.3.10
|
341
|
+
if (!Object.preventExtensions) {
|
342
|
+
Object.preventExtensions = function preventExtensions(object) {
|
343
|
+
// this is misleading and breaks feature-detection, but
|
344
|
+
// allows "securable" code to "gracefully" degrade to working
|
345
|
+
// but insecure code.
|
346
|
+
return object;
|
347
|
+
};
|
348
|
+
}
|
349
|
+
|
350
|
+
// ES5 15.2.3.11
|
351
|
+
// http://es5.github.com/#x15.2.3.11
|
352
|
+
if (!Object.isSealed) {
|
353
|
+
Object.isSealed = function isSealed(object) {
|
354
|
+
return false;
|
355
|
+
};
|
356
|
+
}
|
357
|
+
|
358
|
+
// ES5 15.2.3.12
|
359
|
+
// http://es5.github.com/#x15.2.3.12
|
360
|
+
if (!Object.isFrozen) {
|
361
|
+
Object.isFrozen = function isFrozen(object) {
|
362
|
+
return false;
|
363
|
+
};
|
364
|
+
}
|
365
|
+
|
366
|
+
// ES5 15.2.3.13
|
367
|
+
// http://es5.github.com/#x15.2.3.13
|
368
|
+
if (!Object.isExtensible) {
|
369
|
+
Object.isExtensible = function isExtensible(object) {
|
370
|
+
// 1. If Type(O) is not Object throw a TypeError exception.
|
371
|
+
if (Object(object) !== object) {
|
372
|
+
throw new TypeError(); // TODO message
|
373
|
+
}
|
374
|
+
// 2. Return the Boolean value of the [[Extensible]] internal property of O.
|
375
|
+
var name = '';
|
376
|
+
while (owns(object, name)) {
|
377
|
+
name += '?';
|
378
|
+
}
|
379
|
+
object[name] = true;
|
380
|
+
var returnValue = owns(object, name);
|
381
|
+
delete object[name];
|
382
|
+
return returnValue;
|
383
|
+
};
|
384
|
+
}
|
385
|
+
|
386
|
+
});
|