attrs, directives, nodeLinkFn, childNodes, childLinkFn, linkFnFound, nodeLinkFnFound; for (var i = 0; i < nodeList.length; i++) { attrs = new Attributes();
/* eslint-env mocha, browser */ /* global proclaim */ it('is a function', function () { proclaim.isFunction(NodeList.prototype.forEach); });
/** * Compile a node list and return a childLinkFn. * * @param {NodeList} nodeList * @param {Object} options * @return {Function|undefined} */ function compileNodeList(nodeList, options) { var linkFns = []; var nodeLinkFn, childLinkFn, node; for (var i = 0, l = nodeList.length; i < l; i++) { node = nodeList[i]; nodeLinkFn = compileNode(node, options); childLinkFn = !(nodeLinkFn && nodeLinkFn.terminal) && node.tagName !== 'SCRIPT' && node.hasChildNodes() ? compileNodeList(node.childNodes, options) : null; linkFns.push(nodeLinkFn, childLinkFn); } return linkFns.length ? makeChildLinkFn(linkFns) : null; }
/** * Extract qualified content nodes from a node list. * * @param {NodeList} nodes * @return {DocumentFragment} */ function extractFragment(nodes, parent) { var frag = document.createDocumentFragment(); nodes = toArray(nodes); for (var i = 0, l = nodes.length; i < l; i++) { var node = nodes[i]; if (isTemplate(node) && !node.hasAttribute('v-if') && !node.hasAttribute('v-for')) { parent.removeChild(node); node = parseTemplate(node, true); } frag.appendChild(node); } return frag; }
test("returns the aria owners for a given element", function() { var owned = document.createElement("div"); var ownerCount = 5; owned.id = "theOwned"; this.fixture_.appendChild(owned); for(var i = 0; i < ownerCount; i++) { var owner = document.createElement("div"); owner.setAttribute("aria-owns", "theOwned"); owner.setAttribute("class", "owner"); this.fixture_.appendChild(owner); } var expected = this.fixture_.querySelectorAll(".owner"); var actual = axs.utils.getIdReferrers("aria-owns", owned); equal(expected.length, ownerCount); // sanity check the test itself equal(actual.length, ownerCount); var allFound = Array.prototype.every.call(expected, function(element) { return (Array.prototype.indexOf.call(actual, element) >= 0); }); equal(allFound, true); });
/** * An element's ID must not be present in more that one aria-owns attribute at any time. */ axs.AuditRules.addRule({ name: 'multipleAriaOwners', heading: 'An element\'s ID must not be present in more that one aria-owns attribute at any time', url: 'https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#ax_aria_07', severity: axs.constants.Severity.WARNING, relevantElementMatcher: function(element) { /* * While technically we could instead match elements with ID attribute * if there are no [aria-owns] elements then this rule is not relevant. * The fact that the element which will end up having an error is not * one of these elements is OK. */ return axs.browserUtils.matchSelector(element, '[aria-owns]'); }, test: function(element) { var attr = 'aria-owns'; var ownedElements = axs.utils.getIdReferents(attr, element); return ownedElements.some(function(ownedElement) { var owners = axs.utils.getIdReferrers(attr, ownedElement); return (owners.length > 1); }); }, code: 'AX_ARIA_07' });
componentDidMount() { // Add nodes that already exist at time React app is downloaded; const nodeList = document.querySelectorAll('.post_about_cat'); if (nodeList.length > 0) { this.setState({ nodeList }); } //Start watching for new specific nodes in outside app that contain class 'post_about_cat' const mutationObserver = new MutationObserver(mutations => { mutations.forEach(mutation => { const newNodes = mutation.addedNodes; newNodes.forEach(node => { if (node.classList && node.classList.contains('post_about_cat')) { this.setState(prevState => ({nodeList: [...prevState.nodeList, node]})); } }); }); }); mutationObserver.observe(document.body, { attributes: false, characterData: false, childList: true, subtree: true, attributeOldValue: false, characterDataOldValue: false }); }
const fileList = $(pageConf.fileListSelector) const observer = new MutationObserver((mutations) => { const newFileContainer = mutations[0].addedNodes[0] if (newFileContainer) { addFileWatcher($(pageConf.containerSelector, newFileContainer))
it('is Array.prototype.forEach', function () { proclaim.deepStrictEqual(NodeList.prototype.forEach, Array.prototype.forEach); });
for (var i = 0; i < owners.length; i++) { var ownerRole = axs.utils.getRoles(owners[i], true); if (ownerRole && ownerRole.applied && requiredScope.indexOf(ownerRole.applied.name) >= 0)
attrs, directives, nodeLinkFn, childNodes, childLinkFn, linkFnFound; for (var i = 0; i < nodeList.length; i++) { attrs = new Attributes();
it('has correct name', function () { proclaim.hasName(NodeList.prototype.forEach, 'forEach'); });
it('has correct arity', function () { proclaim.arity(NodeList.prototype.forEach, 1); });
test("returns the elements this element labels", function() { var label = document.createElement("div"); var labelledCount = 2; label.id = "theLabel"; this.fixture_.appendChild(label); for(var i = 0; i < labelledCount; i++) { var labelled = document.createElement("div"); labelled.setAttribute("aria-labelledby", "theLabel notPresentInDom"); labelled.setAttribute("class", "labelled"); this.fixture_.appendChild(labelled); } var expected = this.fixture_.querySelectorAll(".labelled"); var actual = axs.utils.getIdReferrers("aria-labelledby", label); equal(expected.length, labelledCount); // sanity check the test itself equal(actual.length, labelledCount); var allFound = Array.prototype.every.call(expected, function(element) { return (Array.prototype.indexOf.call(actual, element) >= 0); }); equal(allFound, true); });
attrs, directives, nodeLinkFn, childNodes, childLinkFn, linkFnFound, nodeLinkFnFound; for (var i = 0; i < nodeList.length; i++) { attrs = new Attributes();