diff --git a/lib/rules/html-namespace-matches.js b/lib/rules/html-namespace-matches.js
index 81dde067a1..b6eb443dcb 100644
--- a/lib/rules/html-namespace-matches.js
+++ b/lib/rules/html-namespace-matches.js
@@ -1,5 +1,7 @@
-function htmlNamespaceMatches(node) {
- return node.namespaceURI === 'http://www.w3.org/1999/xhtml';
+import svgNamespaceMatches from './svg-namespace-matches';
+
+function htmlNamespaceMatches(node, virtualNode) {
+ return !svgNamespaceMatches(node, virtualNode);
}
export default htmlNamespaceMatches;
diff --git a/test/rule-matches/html-namespace-matches.js b/test/rule-matches/html-namespace-matches.js
index 5da2a7750f..4731552c57 100644
--- a/test/rule-matches/html-namespace-matches.js
+++ b/test/rule-matches/html-namespace-matches.js
@@ -45,4 +45,37 @@ describe('html-namespace-matches', function() {
var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node);
assert.isFalse(rule.matches(node, virtualNode));
});
+
+ describe('Serial Virtual Node', function() {
+ it('returns true when passed an HTML element', function() {
+ var serialNode = new axe.SerialVirtualNode({
+ nodeName: 'h1'
+ });
+ serialNode.parent = null;
+
+ assert.isTrue(rule.matches(null, serialNode));
+ });
+
+ it('returns true when passed a custom HTML element', function() {
+ var serialNode = new axe.SerialVirtualNode({
+ nodeName: 'xx-heading'
+ });
+ serialNode.parent = null;
+
+ assert.isTrue(rule.matches(null, serialNode));
+ });
+
+ it('returns false when passed an SVG circle element', function() {
+ var serialNode = new axe.SerialVirtualNode({
+ nodeName: 'circle'
+ });
+ var parent = new axe.SerialVirtualNode({
+ nodeName: 'svg'
+ });
+ serialNode.parent = parent;
+ parent.children = [serialNode];
+
+ assert.isFalse(rule.matches(null, serialNode));
+ });
+ });
});