Browse Source

Merge branch 'polyfill-non-enum'

pull/30/head
Sami Vaarala 10 years ago
parent
commit
d733dca7a2
  1. 7
      RELEASES.txt
  2. 12
      polyfills/console-minimal.js
  3. 8
      polyfills/object-prototype-definegetter.js
  4. 8
      polyfills/object-prototype-definesetter.js

7
RELEASES.txt

@ -449,6 +449,9 @@ Planned
0.12.0 (2014-08-XX)
-------------------
* Beta release for stabilization: feature freeze until 1.0.0 release, most
work will be testing, bug fixes, and documentation
* Change strictness handling of duk_eval() and variants so that all code is
evaluated in non-strict mode by default (unless the code itself contains
a "use strict" directive); without this change the strictness would depend
@ -466,8 +469,8 @@ Planned
* Minor compile warnings fixes for non-default options (e.g. when reference
counting is disabled)
* Beta release for stabilization: feature freeze until 1.0.0 release, most
work will be testing, bug fixes, and documentation
* Make objects and functions defined by included polyfills non-enumerable so
that they don't enumerate e.g. in a for-in loop
1.0.0 (2014-08-XX)
------------------

12
polyfills/console-minimal.js

@ -1,8 +1,12 @@
if (typeof console === 'undefined') {
this.console = {};
Object.defineProperty(this, 'console', {
value: {}, writable: true, enumerable: false, configurable: true
});
}
if (typeof console.log === 'undefined') {
this.console.log = function () {
print(Array.prototype.join.call(arguments, ' '));
};
Object.defineProperty(this.console, 'log', {
value: function () {
print(Array.prototype.join.call(arguments, ' '));
}, writable: true, enumerable: false, configurable: true
});
}

8
polyfills/object-prototype-definegetter.js

@ -1,5 +1,7 @@
if (typeof Object.prototype.__defineGetter__ === 'undefined') {
Object.prototype.__defineGetter__ = function (n, f) {
Object.defineProperty(this, n, { enumerable: true, configurable: true, get: f });
};
Object.defineProperty(Object.prototype, '__defineGetter__', {
value: function (n, f) {
Object.defineProperty(this, n, { enumerable: true, configurable: true, get: f });
}, writable: true, enumerable: false, configurable: true
});
}

8
polyfills/object-prototype-definesetter.js

@ -1,5 +1,7 @@
if (typeof Object.prototype.__defineSetter__ === 'undefined') {
Object.prototype.__defineSetter__ = function (n, f) {
Object.defineProperty(this, n, { enumerable: true, configurable: true, set: f });
};
Object.defineProperty(Object.prototype, '__defineSetter__', {
value: function (n, f) {
Object.defineProperty(this, n, { enumerable: true, configurable: true, set: f });
}, writable: true, enumerable: false, configurable: true
});
}

Loading…
Cancel
Save