[HtmlUnit] [htmlunit:bugs] #1682 DOCTYPE starting with <? results in DOM without expected elements

RBRi via HtmlUnit-develop <[email protected]>
Newsgroups gmane.comp.java.htmlunit.devel
Message-ID </p/htmlunit/bugs/1682/3c45310eb7f7da4e9f740d1fa984ef805f226934.bugs@htmlunit.p.sourceforge.net>
- **status**: accepted --> closed
- **assigned_to**: Ahmed Ashour --> RBRi
- **Comment**:

Fixed.



---

** [bugs:#1682] DOCTYPE starting with <? results in DOM without expected elements**

**Status:** closed
**Group:** Latest SVN
**Created:** Sat May 09, 2015 06:10 AM UTC by Sebastian Cato
**Last Updated:** Fri Feb 02, 2018 06:34 PM UTC
**Owner:** RBRi


Hello,

Came across a site that didn't render the DOM I was expecting (lacking an HtmlForm node) in HtmlUnit. I isolated the problem to an incorrect doctype on the site, starting with <? instead of <!.

On trunk, r10440:

~~~~~
    @Test
    public void testDoctypeQuestionmark() throws Exception {
   	 final String content = "<?doctype html>\n" + 
   	 		"<html>\n" + 
   	 		"  <head>\n" + 
   	 		"  <title>foo</title>\n" + 
   	 		"  </head>\n" +  
   	 		"  <body>\n" +
   	 		"    <form action=\"#\" method=\"post\"> \n" + 
   	 		"	  <input type=\"text\" name=\"foo\">\n" + 
   	 		"	  <input type=\"submit\">\n" + 
   	 		"    </form>\n" + 
   	 		"  </body>\n" + 
   	 		"</html>\n";
   	 
        final MockWebConnection webConnection = new MockWebConnection();
        final URL url = new URL("http://www.example.com/");
        webConnection.setResponse(url, content);
        final WebClient client = new WebClient();
        client.setWebConnection(webConnection);

        final HtmlPage page = client.getPage(url);
        assertTrue(page.getForms().size() == 1);
        client.close();
    }
~~~~~


---

Sent from sourceforge.net because [email protected] is subscribed to https://sourceforge.net/p/htmlunit/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/htmlunit/admin/bugs/options.  Or, if this is a mailing list, you can unsubscribe from the mailing list.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

_______________________________________________
HtmlUnit-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.