olivernn / davis.js

RESTful degradable JavaScript routing using pushState
http://davisjs.com
532 stars 58 forks source link

Normalize tag case for true XHTML #12

Closed sabberworm closed 12 years ago

sabberworm commented 13 years ago

For compatibility with documents served as application/xhtml+xml, tagName checks need always be normalized.

olivernn commented 12 years ago

Do you have an example of the issue this is solving, or some steps to re-create your issue?

sabberworm commented 12 years ago

Steps to reproduce:

  1. Create an XHTML file with a link.
  2. Include jQuery.
  3. Include davis.js and use Davis(jQuery.noop).start().
  4. Serve said file with the Content-Type: application/xhtml+xml MIME Header.
  5. Navigate the browser to the served location. Open the console.
  6. Click on the link.

EXPECTED results: The log should say: routeNotFound: GET ….

ACTUAL results: No log entry… Davis did not detect the click.

sabberworm commented 12 years ago

I think you can also save the HTML file with a .xhtml or .xml extension and open the file in the browser locally to see the error (at least in Firefox). The reason behind this is that the XML DOM (in contrast to the HTML/SGML DOM) does not do any case-folding on tag names (and attributes).

olivernn commented 12 years ago

Ok, I've managed to re-create this now. I'm going to call toUpperCase on the nodeName rather than change the origin checks object as well.

olivernn commented 12 years ago

I've just pushed a new release (0.6.1) which fixes this problem.

sabberworm commented 12 years ago

Thanks!