polyfills.WeakSet.meta.json Maven / Gradle / Ivy
The newest version!
{"aliases":["es6"],"browsers":{"ie":"7 - 11","ie_mob":"10 - 11","safari":"<9","chrome":"<38","firefox":"<34","android":"*","ios_saf":"<9","opera":"<25","firefox_mob":"<34","bb":"10 - *"},"dependencies":["Object.defineProperty","Array.prototype.forEach","Date.now"],"repo":"https://github.com/webcomponents/webcomponentsjs","license":"https://github.com/webcomponents/webcomponentsjs/blob/master/LICENSE.md","docs":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet","detectSource":"(function(global) {\n\tif (!(\"WeakSet\" in global)) return false;\n\tvar o = {};\n\tvar ws = new WeakSet([o]);\n\treturn (!!ws.has(o));\n}(this))","testSource":"","baseDir":"WeakSet","hasTests":true,"testsSource":"/* eslint-env mocha, browser*/\n/* global proclaim, it */\n\nit('should be instantiable', function(){\n\tfunction nameOf(fn) {\n\t\treturn Function.prototype.toString.call(fn).match(/function\\s*([^\\s]*)\\(/)[1];\n\t}\n\tproclaim.equal(nameOf(WeakSet), 'WeakSet');\n\tproclaim.isTypeOf(new WeakSet, 'object');\n});\n\nit('has add, delete and has methods', function(){\n\tproclaim.notEqual(WeakSet.prototype['add'], undefined);\n\tproclaim.notEqual(WeakSet.prototype['delete'], undefined);\n\tproclaim.notEqual(WeakSet.prototype['has'], undefined);\n});\n\nit('should perform as expected', function() {\n\tvar a = new WeakSet, b = {}, c = function(){}, d = window, e = {};\n\tvar set = new WeakSet;\n\n\tset.add(a);\n\tset.add(b);\n\tset.add(c);\n\tset.add(d);\n\n\tproclaim.equal(set.has(a), true);\n\tproclaim.equal(set.has(b), true);\n\tproclaim.equal(set.has(c), true);\n\tproclaim.equal(set.has(d), true);\n\tproclaim.equal(set.has(e), false);\n\n\tproclaim.equal(set['delete'](b), true);\n\tproclaim.equal(set['delete'](c), true);\n\tproclaim.equal(set['delete'](d), true);\n\tproclaim.equal(set['delete'](e), false);\n\n\tproclaim.equal(set.has(a), true);\n\tproclaim.equal(set.has(b), false);\n\tproclaim.equal(set.has(c), false);\n\tproclaim.equal(set.has(d), false);\n\tproclaim.equal(set.has(e), false);\n});\n\nit('should be chainable', function() {\n\tvar ws = new WeakSet();\n\tvar o1 = {};\n\tvar o2 = function(){};\n\tws.add(o1).add(o2);\n\tproclaim.equal(ws.has(o2), true);\n})\n\n// IE <= 8 does not allow invocation of delete as a property of an object using dot notation\nit.skip('should allow use of dot notation for delete method', function() {\n\tvar ws = new WeakSet();\n\tvar o1 = {};\n\tws.add(o1);\n\t//ws.delete(o1); // Causes an error during parse in IE<=8, which will prevent other tests from running even though this test is marked as skipped!\n\tproclaim.equal(ws.has(o1), false);\n})\n\n// Early native implementations do not support this, polyfill does\nit('should be possible to prepopulate the set', function() {\n\tvar o1 = {};\n\tvar ws = new WeakSet([\n\t\to1,\n\t\tfunction(){},\n\t\twindow,\n\t\t{}\n\t]);\n\n\tproclaim.equal(ws.has({}), false);\n\tproclaim.equal(ws.has(o1), true);\n\tproclaim.equal(ws.has(window), true);\n});"}