polyfills.document.querySelector.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":["Element","Document"],"spec":"http://www.w3.org/TR/selectors-api/","docs":"https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector","detectSource":"'document' in this && 'querySelector' in this.document","testSource":"","baseDir":"document.querySelector","hasTests":true,"testsSource":"/* eslint-env mocha, browser*/\n/* global proclaim, it */\n\nit('returns the right length', function () {\n\tproclaim.equal(document.querySelectorAll('body').length, 1);\n});\n\nit('matches element by tag', function () {\n\tproclaim.equal(document.querySelector('body'), document.body);\n});\n\nit('matches element by id', function () {\n\tvar\n\telement = document.body.appendChild(document.createElement('p')),\n\tid = element.id = 'id' + String(Math.random()).slice(3);\n\n\tproclaim.equal(document.querySelector('#' + id), element);\n});\n\nit('matches element by class', function () {\n\tvar element = document.body.appendChild(document.createElement('p'));\n\n\telement.className = 'foo bar qux';\n\n\tproclaim.equal(document.querySelector('.bar'), element);\n});\n\n/*\n * Skipped: I don't believe it's possible to determine reliably whether the CSS engine\n * was able to parse the selector, so some browsers will return false for an invalid\n * selector rather than throwing the expected SyntaxError.\n *\nit('throws an exception for invalid selectors', function () {\n\tproclaim.throws(function () {\n\t\tdocument.querySelector(\"an>invalid<:selector\");\n\t});\n});\n */"}