polyfills.document.getElementsByClassName.meta.json Maven / Gradle / Ivy
The newest version!
{"browsers":{"ie":"<9"},"dependencies":["document.querySelector"],"spec":"https://dom.spec.whatwg.org/#dom-document-getelementsbyclassname","docs":"https://developer.mozilla.org/en/docs/Web/API/Document/getElementsByClassName","detectSource":"'document' in this && 'getElementsByClassName' in this.document","testSource":"","baseDir":"document.getElementsByClassName","hasTests":true,"testsSource":"/* eslint-env mocha, browser*/\n/* global proclaim, it */\n\nit('finds an element using a class name', function () {\n\tvar div = document.body.appendChild(document.createElement('DIV'));\n\tdiv.className = 'abcd';\n\tvar a = document.getElementsByClassName('abcd');\n\tproclaim.equal(a.length, 1);\n\tdocument.body.removeChild(div);\n});\n\nit('converts undefined into a string', function () {\n\tvar div = document.body.appendChild(document.createElement('DIV'));\n\tdiv.innerHTML = 'foo
foo
';\n\tproclaim.equal(document.getElementsByClassName(undefined).length, 2);\n\tproclaim.equal(document.getElementsByClassName(\"undefined\").length, 2);\n\tdocument.body.removeChild(div);\n});\n\nit('supports multiple space-separated classes', function () {\n\tvar div = document.body.appendChild(document.createElement('DIV'));\n\tdiv.innerHTML = 'foo
foo
';\n\tproclaim.equal(document.getElementsByClassName('one two').length, 2);\n\tdocument.body.removeChild(div);\n});"}