Browse Source

not relying on enumerable: false

In IE8, even if shimmed, the property is created enumerable.
This ends in a bug when calling rebuild,
where ensure is nulled because not hidden as non-enumerable.
Herbert Vojčík 10 years ago
parent
commit
9a6db9e0ea
1 changed files with 2 additions and 0 deletions
  1. 2 0
      brikz.js

+ 2 - 0
brikz.js

@@ -13,6 +13,7 @@ function Brikz(api, apiKey, initKey) {
 
 	var d={value: null, enumerable: false, configurable: true, writable: true};
 	Object.defineProperties(this, { ensure: d, rebuild: d });
+	var exclude = mixin(this, {});
 
 	this.rebuild = function () {
 		Object.keys(backup).forEach(function (key) {
@@ -20,6 +21,7 @@ function Brikz(api, apiKey, initKey) {
 		});
 		var oapi = mixin(api, {}), order = [], chk = {};
 		brikz.ensure = function(key) {
+			if (key in exclude) { return null; }
 			var b = brikz[key], bak = backup[key];
 			mixin({}, api, api);
 			while (typeof b === "function") { b = new b(brikz, api, bak); }