polyfills.XMLHttpRequest.meta.json Maven / Gradle / Ivy
The newest version!
{"aliases":["default-3.3","default-3.4","default-3.5","default-3.6","default","blissfuljs"],"browsers":{"ie":"6 - 8"},"dependencies":["Event"],"docs":"https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest","detectSource":"'XMLHttpRequest' in this && 'prototype' in this.XMLHttpRequest && 'addEventListener' in this.XMLHttpRequest.prototype","testSource":"","baseDir":"XMLHttpRequest","hasTests":true,"testsSource":"/* eslint-env mocha, browser*/\n/* global proclaim, it */\n\nvar xhr;\n\nfunction nameOf(fn) {\n\treturn Function.prototype.toString.call(fn).match(/function\\s*([^\\s]*)\\(/)[1];\n}\n\n// REMOVED: Safari considers XMLHttpRequest an object\nit.skip('has correct instance', function () {\n\tproclaim.isInstanceOf(XMLHttpRequest, Function);\n});\n\n// REMOVED: Firefox considers XMLHttpRequest a function, but does not allow you to use Function.prototype.toString (yet accepts XMLHttpRequest.toString!)\nit.skip('has correct name', function () {\n\tproclaim.equal(nameOf(XMLHttpRequest), 'XMLHttpRequest');\n});\n\n// REMOVED: See above\nit.skip('has correct argument length', function () {\n\tproclaim.equal(XMLHttpRequest.length, 0);\n});\n\nit('can create instance', function () {\n\txhr = new XMLHttpRequest;\n});\n\nit('can setup request', function () {\n\tproclaim.isInstanceOf(xhr.open, Function);\n\tproclaim.equal(nameOf(xhr.open), 'open');\n\n\tproclaim.isInstanceOf(xhr.addEventListener, Function);\n\tproclaim.equal(nameOf(xhr.addEventListener), 'addEventListener');\n\n\tproclaim.isInstanceOf(xhr.send, Function);\n\tproclaim.equal(nameOf(xhr.send), 'send');\n});\n\n// REMOVED: Inconsistent between browsers, does not affect functionality\nit.skip('has methods with correct argument length', function() {\n\tproclaim.equal(xhr.open.length, 2);\n\tproclaim.equal(xhr.addEventListener.length, 0);\n\tproclaim.equal(xhr.send.length, 0);\n\n});\n\nit('can make request', function () {\n\txhr.open('GET', location.href);\n\n\txhr.addEventListener('load', function (event) {\n\t\tproclaim.equal(arguments.length, 1);\n\t\tproclaim.deepEqual(event.currentTarget, xhr);\n\t});\n\n\txhr.send();\n});"}