diff --git a/src/main/java/org/htmlunit/cyberneko/html/dom/HTMLDocumentImpl.java b/src/main/java/org/htmlunit/cyberneko/html/dom/HTMLDocumentImpl.java index de2f6e05..0560fe53 100644 --- a/src/main/java/org/htmlunit/cyberneko/html/dom/HTMLDocumentImpl.java +++ b/src/main/java/org/htmlunit/cyberneko/html/dom/HTMLDocumentImpl.java @@ -503,10 +503,18 @@ public Element createElementNS(final String namespaceURI, final String qualified @Override public Element createElementNS(final String namespaceURI, final String qualifiedname) { if (namespaceURI == null - || namespaceURI.length() == 0 - || NamespaceBinder.XHTML_1_0_URI.equals(namespaceURI)) { + || namespaceURI.length() == 0) { return createElement(qualifiedname); } + + if (NamespaceBinder.XHTML_1_0_URI.equals(namespaceURI)) { + final int index = qualifiedname.indexOf(':'); + if (index != -1) { + return createElement(qualifiedname.substring(index + 1)); + } + return createElement(qualifiedname); + } + return super.createElementNS(namespaceURI, qualifiedname); } diff --git a/src/test/resources/org/htmlunit/cyberneko/testfiles/canonical/test082.html.canonical-domhtml b/src/test/resources/org/htmlunit/cyberneko/testfiles/canonical/test082.html.canonical-domhtml index d2d4b35d..8b7bc00b 100644 --- a/src/test/resources/org/htmlunit/cyberneko/testfiles/canonical/test082.html.canonical-domhtml +++ b/src/test/resources/org/htmlunit/cyberneko/testfiles/canonical/test082.html.canonical-domhtml @@ -1,7 +1,7 @@ (HTML (HEAD )HEAD -(H:BODY +(BODY A{http://www.w3.org/2000/xmlns/}xmlns:h http://www.w3.org/1999/xhtml -)H:BODY +)BODY )HTML