MoOx / pjax

Easily enable fast Ajax navigation on any website (using pushState + xhr)
MIT License
1.46k stars 125 forks source link

loadContent doesn't match "just" <html> #6

Closed jeromegn closed 10 years ago

jeromegn commented 10 years ago

Hey there,

I've been fiddling around with your library. Works well!

I found a small bug. This regex (https://github.com/MoOx/pjax/blob/master/src/pjax.js#L346) doesn't match <html>. It matches <html lang="en"> and a lot of other possibilities. But not plain old <html>!

Or maybe this (https://github.com/MoOx/pjax/blob/master/src/pjax.js#L349) should be if (matches && matches.length)

Thought I'd let you know.

Edit: Crap, let me rephrase this: String.prototype.match returns null if nothing is matched. It seems like that was what you were trying to do on that line. That's probably the issue.

MoOx commented 10 years ago

Thanks for reporting that issue. I need to add automated tests, so I can fix that issue properly :) I'll do that asap.

jeromegn commented 10 years ago

I would recommend Zombie!

supermensa commented 10 years ago

if (matches && matches.length) fixed a problem I had with the error Uncaught TypeError: Cannot read property 'length' of null

MoOx commented 10 years ago

Fix should be available in 0.1.4