Dashboard sipadu mbip
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

manageAriaHidden.js 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. "use strict";
  2. exports.__esModule = true;
  3. exports.ariaHidden = ariaHidden;
  4. exports.hideSiblings = hideSiblings;
  5. exports.showSiblings = showSiblings;
  6. var BLACKLIST = ['template', 'script', 'style'];
  7. var isHidable = function isHidable(_ref) {
  8. var nodeType = _ref.nodeType,
  9. tagName = _ref.tagName;
  10. return nodeType === 1 && BLACKLIST.indexOf(tagName.toLowerCase()) === -1;
  11. };
  12. var siblings = function siblings(container, exclude, cb) {
  13. exclude = [].concat(exclude);
  14. [].forEach.call(container.children, function (node) {
  15. if (exclude.indexOf(node) === -1 && isHidable(node)) {
  16. cb(node);
  17. }
  18. });
  19. };
  20. function ariaHidden(show, node) {
  21. if (!node) return;
  22. if (show) {
  23. node.setAttribute('aria-hidden', 'true');
  24. } else {
  25. node.removeAttribute('aria-hidden');
  26. }
  27. }
  28. function hideSiblings(container, _ref2) {
  29. var root = _ref2.root,
  30. backdrop = _ref2.backdrop;
  31. siblings(container, [root, backdrop], function (node) {
  32. return ariaHidden(true, node);
  33. });
  34. }
  35. function showSiblings(container, _ref3) {
  36. var root = _ref3.root,
  37. backdrop = _ref3.backdrop;
  38. siblings(container, [root, backdrop], function (node) {
  39. return ariaHidden(false, node);
  40. });
  41. }