defunkt / jquery-pjax

pushState + ajax = pjax
https://pjax.herokuapp.com
MIT License
16.73k stars 1.97k forks source link

Error when loading full html-document without <head> or with empty <head/> #625

Closed Argelbargel closed 7 years ago

Argelbargel commented 8 years ago

If the html loaded by pjax does start with an <html>-tag but does not contain a <head>- or just an empty <head/>-tag, an error is thrown in extractContainer because the regex-match looking for content within <head></head>-tags does not match and returns null instead of an array.

As the HTML-Specification enforces (at least as i understand it) that an <html>-tag always has an <head> and a <body>-tag but <head> may be empty (<title> is optional "when a higher-level protocol provides title information"), it seems that pjax should be able to handle this situation.