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

aXe fails on XHTML documents with prefixed element names #563

Closed
rdeltour opened this issue Oct 9, 2017 · 0 comments
Closed

aXe fails on XHTML documents with prefixed element names #563

rdeltour opened this issue Oct 9, 2017 · 0 comments

Comments

@rdeltour
Copy link
Contributor

rdeltour commented Oct 9, 2017

When ran against an XHTML document with namespaced elements, aXe crashes with a syntax error on the matchesSelector function.

This is due to the selector creation using the element’s nodeName, which results in an (invalid) selector of the form prefix:name.

Since the DOM Standard doesn't plan to support namespaces with selectors, the best approach would probably be to use the element’s local name as the selector (instead of the prefixed node name).

This can be reproduced with the following document:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta charset="utf-8" />
  <title>Math Sample</title>
</head>
<body>
<h1>Math Sample</h1>
<m:math alttext="x" xmlns:m="http://www.w3.org/1998/Math/MathML">
  <m:semantics>
    <m:mi>x</m:mi>
    <m:annotation-xml encoding="MathML-Content">
      <m:ci>x</m:ci>
    </m:annotation-xml>
  </m:semantics>
</m:math>
</body>
</html>
rdeltour added a commit to daisy/ace that referenced this issue Oct 9, 2017
aXe is creating CSS selectors for relevant elements in the checked
content. When faced with XML-namespaced element names (e.g. MathML
elements), it used the prefixed element name as a selector for the
element, which caused a syntax error when matching against this
selector.

To fix this, we copy part of aXe's code in our own file as a monkey
patch.
This must be removed when dequelabs/axe-core#563 is fixed.

Closes #57
rdeltour pushed a commit to rdeltour/axe-core that referenced this issue Oct 24, 2017
- by default, ensure the nodename is escaped
- for XHTML documents, only use the local name

Replaces dequelabs#566
Closes dequelabs#563
rdeltour pushed a commit to rdeltour/axe-core that referenced this issue Dec 15, 2017
- by default, ensure the nodename is escaped
- for XHTML documents, only use the local name

Replaces dequelabs#566
Closes dequelabs#563
rdeltour pushed a commit to rdeltour/axe-core that referenced this issue Dec 15, 2017
- by default, ensure the nodename is escaped
- for XHTML documents, only use the local name

Replaces dequelabs#566
Closes dequelabs#563
WilcoFiers pushed a commit that referenced this issue Dec 15, 2017
)

* feat(utils): add function `isXHTML` to test if a document node is XHTML

* test(utils): add a test for `axe.utils.isXHTML` on an XHTML document

* fix(getSelector): improve selectors for namespaced elements

- by default, ensure the nodename is escaped
- for XHTML documents, only use the local name

Replaces #566
Closes #563

* test(getSelector): add a test for `axe.utils.getSelector` on a namespaced XHTML element
WilcoFiers pushed a commit that referenced this issue Dec 15, 2017
)

* feat(utils): add function `isXHTML` to test if a document node is XHTML

* test(utils): add a test for `axe.utils.isXHTML` on an XHTML document

* fix(getSelector): improve selectors for namespaced elements

- by default, ensure the nodename is escaped
- for XHTML documents, only use the local name

Replaces #566
Closes #563

* test(getSelector): add a test for `axe.utils.getSelector` on a namespaced XHTML element
mrtnvh pushed a commit to mrtnvh/axe-core that referenced this issue Nov 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant