Comments (3)
well, this will find all ShadowHost elements:
// see https://developer.mozilla.org/en-US/docs/Web/API/NodeFilter
var ShadowHostFilter = {
acceptNode: function(node) {
return node.shadowRoot ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
// possible optimization using FILTER_REJECT to skip checking the children
}
};
function findShadowHosts(context, deep) {
// see https://developer.mozilla.org/en-US/docs/Web/API/Document/createTreeWalker
var shadowHostFinder = document.createTreeWalker(
// root element to start search in
context || document.documentElement,
// element type filter
NodeFilter.SHOW_ELEMENT,
// custom NodeFilter filter
ShadowHostFilter
);
var shadowHosts = [];
while (shadowHostFinder.nextNode()) {
shadowHosts.push(shadowHostFinder.currentNode);
if (deep) {
var children = findShadowHosts(shadowHostFinder.currentNode.shadowRoot, deep);
shadowHosts = shadowHosts.concat(children);
}
}
return shadowHosts;
}
// find all ShadowHosts recursively
findShadowHosts(document.documentElement, true);
from ally.js.
Maybe this was a bit premature, as >>>
will remain available to querySelectorAll()
- https://twitter.com/tabatkins/status/624254124398243840
We'll have to figure out how to make ally/style/focus-source
work without >>>
.
from ally.js.
query/focusable
in "quick" mode (default) requires the support of "Shadow Piercing Descendant Combinator" for Shadow DOM introspection, "strict" mode does not (and will therefore work in Firefox).
from ally.js.
Related Issues (20)
- ally.maintain.tabFocus breaks tab in Android + Chrome HOT 6
- Error setting up focusWithin HOT 1
- Wrong focus-source on Chrome on first Input element HOT 1
- Radio groups are not considered when maintaining tab focus
- ally.query.tabsequence possible string comparison of tabindex
- Improve visuallyhidden class further HOT 4
- Fix for Firefox accidentally triggering click after focus change on space HOT 8
- Allow Option to Pass Array of Elements to Maintain Components HOT 5
- Error on Import when Running CreateReactApp Test HOT 3
- Webpack bundle
- How to trap tab focus in element but allow tabbing to browser UI? HOT 4
- Current project status HOT 1
- Feature Request(?): Ability to run the browser support tests explicitly HOT 4
- Shadow DOM elements not identified correctly as contained by a parent element for maintain.disabled
- iOS 10.3 - 11.0 ally.maintain.tabFocus OSK (OnScreenKeyboard) shows and disappear for some milliseconds HOT 1
- Dialog content not focused when opened in Mac / VoiceOver
- Platform.js vulnerability issue HOT 1
- ally.maintain.tabFocus throws error when pressing Tab inside a dialog without focusable elements
- Cannot read property '0' of null in detect-focus
- Is this library dead?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ally.js.