Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getFlattenedTree fails on firefox in pages with <content> elements #1576

Closed
AdnoC opened this issue May 17, 2019 · 5 comments
Closed

getFlattenedTree fails on firefox in pages with <content> elements #1576

AdnoC opened this issue May 17, 2019 · 5 comments
Assignees
Labels
fix Bug fixes

Comments

@AdnoC
Copy link
Contributor

AdnoC commented May 17, 2019

Expectation: It shouldn't error.

Actual: It errors with TypeError: "e.getDistributedNodes is not a function".

Motivation: Crashing on axe.run isn't good.

Expected to occur on any page developed with shadow DOM v0.

Error occurs on line 110 of lib/core/utils/flattened-tree.js. It calls getDistributedNodes() when the node is a <content> element. The issue is that getDistributedNodes() is deprecated and removed from Firefox.

Minimal page that triggers the bug (taken from this MDN page) (this page as well):

<html>
  <head></head>
  <body>
  <!-- The original content accessed by <content> -->
  <div>
    <h4>My Content Heading</h4>
    <p>My content text</p>
  </div>

  <script>
  // Get the <div> above.
  var myContent = document.querySelector('div');
  // Create a shadow DOM on the <div>
  var shadowroot = myContent.createShadowRoot();
  // Insert into the shadow DOM a new heading and 
  // part of the original content: the <p> tag.
  shadowroot.innerHTML =
   '<h2>Inserted Heading</h2> <content select="p"></content>';
  </script>

  </body>
</html>

axe-core version: 3.2.2
axe-webdriver, extension or other integration version: Extension version: HEAD (afc711a52806daf79a226e6fb8b55d56408a3255)

Browser and Assistive Technology versions

For Tooling issues:
- Platform:  Firefox 66.0.5, Mac

Cause of #1512

@AutoSponge
Copy link
Contributor

For Docs: Not sure if we need to document this or not, but since <content> was deprecated, we're just following up. Anytime the element isn't supported (currently FF) we treat it like a <div>, the same way the engine will treat it as an unrecognized element.

@jeankaplansky
Copy link
Contributor

The point that "anytime an element isn't supported (currently FF) we treat it like a &lt;div&gt;, the same way the engine will treat it as an unrecognized element" isn't something that we diverge from normal FF functionality...

I don't think we're on the hook for documenting that we match FF functionality over a deprecated shadow DOM element.

@WilcoFiers : Opinion?

@jeankaplansky
Copy link
Contributor

Wilco agrees this is not a documentation issue.

@chandana7393
Copy link

Tested with the above code violations are not displayed.
content_no_violations
Tested Environment:
Axe-coconut - 3.8.0.16404v
Chrome - 75v
OS- Windows 10 64 bit.

@chandana7393
Copy link

Tested, "Inserted Heading" was not displayed on Firefox browser because of that unable to see the issues on Axe/Attest Firefox.
No_content_violations
Tested Environment:
Axe - 3.8.0.15616v
Attest - 2.5.0.15616v
Firefox - 66v
OS - Windows 10 64 bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fixes
Projects
None yet
Development

No branches or pull requests

4 participants