Sha256: d1915ac5f1f87d3f5a5ac578223111300f12ee874d42905b8060052bb4641426
Contents?: true
Size: 1.05 KB
Versions: 375
Compression:
Stored size: 1.05 KB
Contents
function cleanupPlugins(resolve, reject) { 'use strict'; resolve = resolve || function() {}; reject = reject || axe.log; if (!axe._audit) { throw new Error('No audit configured'); } var q = axe.utils.queue(); // If a plugin fails it's cleanup, we still want the others to run var cleanupErrors = []; Object.keys(axe.plugins).forEach(function(key) { q.defer(function(res) { var rej = function(err) { cleanupErrors.push(err); res(); }; try { axe.plugins[key].cleanup(res, rej); } catch (err) { rej(err); } }); }); var flattenedTree = axe.utils.getFlattenedTree(document.body); axe.utils .querySelectorAll(flattenedTree, 'iframe, frame') .forEach(function(node) { q.defer(function(res, rej) { return axe.utils.sendCommandToFrame( node.actualNode, { command: 'cleanup-plugin' }, res, rej ); }); }); q.then(function(results) { if (cleanupErrors.length === 0) { resolve(results); } else { reject(cleanupErrors); } }).catch(reject); } axe.cleanup = cleanupPlugins;
Version data entries
375 entries across 375 versions & 1 rubygems