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

Closed
opened 2014-04-29 15:24:29 -05:00 by jeromegn · 4 comments
jeromegn commented 2014-04-29 15:24:29 -05:00 (Migrated from github.com)

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.

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 2014-04-29 15:53:19 -05:00 (Migrated from github.com)

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

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 2014-04-29 16:38:25 -05:00 (Migrated from github.com)

I would recommend Zombie!

I would recommend [Zombie](/assaf/zombie)!
supermensa commented 2014-10-13 14:44:58 -05:00 (Migrated from github.com)

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

`if (matches && matches.length)` fixed a problem I had with the error `Uncaught TypeError: Cannot read property 'length' of null`
MoOx commented 2014-10-14 00:43:53 -05:00 (Migrated from github.com)

Fix should be available in 0.1.4

Fix should be available in 0.1.4
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: iLoveElysia/pjax#6