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