简体   繁体   English

从源代码中删除所有aria-hidden =“ true”

[英]remove all aria-hidden=“true” from source code

I'm trying to remove all the aria-hidden="true" from my html using tampermonkey 我正在尝试使用tampermonkey从我的html中删除所有aria-hidden =“ true”

I've tried to make them visible using this code 我试图使用此代码使它们可见

   var HiddenElements = document.evaluate("//[@aria-hidden='true']",
       document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
     for (var i = HiddenElements.snapshotLength - 1; i >= 0; i--) {
       var elmHidden = HiddenElements.snapshotItem(i);
       elmHidden.style.outline = 'rgb(255, 0, 78) dashed 3px';
       elmHidden.ariahidden = 'false';
   }

Is there any way to make this work ? 有什么办法可以使这项工作吗? and how to debug the results while testing? 以及如何在测试时调试结果?

Regards! 问候!

Here is an example of how it can be done: 这是一个如何完成的示例:

document.querySelectorAll('[aria-hidden="true"]').forEach(item => {

  item.style.outline = 'rgb(255, 0, 78) dashed 3px';
  item.setAttribute('aria-hidden', 'false'); 

  // or remove it
  item.removeAttribute('aria-hidden');
});

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在量角器中,如何检查 aria-hidden = "true" 或 "false" - In Protractor, how to check aria-hidden = "true" or "false" 单击正文时,删除类别并更改咏叹调隐藏值 - Remove class and change aria-hidden value when clicking on body aria-hidden = true是否意味着您不必使用display:none? - Does aria-hidden=true mean you don't have to use display:none? 可访问性:`tabindex="-1"` 是否意味着该元素对屏幕阅读器不可见(类似于 `aria-hidden="true"`) - Accessibility: does `tabindex="-1"` mean the element is not visible to screenreaders (similar to `aria-hidden="true"`) 如何从具有相同属性的一堆元素中获得具有“ aria-hidden”真值的元素? - How do I get an element with `aria-hidden` true out of a bunch of elements that have the same attribute? Javascript 出现 aria-hidden 弹出窗口的问题 - Javascript Issue with aria-hidden popup 咏叹调隐藏的财产不适用于后代 - aria-hidden property not working on descendants 查找所有display:none属性,并使用JavaScript添加aria-hidden属性 - Find all display:none attributes and add in aria-hidden attribute using JavaScript Font-Awesome 添加属性 aria-hidden 可防止图标出现在浏览器中 [SSR] - Font-Awesome adds attribute aria-hidden which prevents icons from appearing in the browser [SSR] NVDA在动态更新后读取咏叹调隐藏内容 - NVDA reads aria-hidden content after dynamic update
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM