Skip to content

Commit feeab3f

Browse files
committed
Merge pull request #4 from braddunbar/history
Check `documentMode` and combine checks.
2 parents 91ef885 + 2c50dc5 commit feeab3f

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

backbone.js

+4-8
Original file line numberDiff line numberDiff line change
@@ -1403,20 +1403,16 @@
14031403

14041404
// Proxy an iframe to handle location events on older versions of IE
14051405
try {
1406-
var body = document.body;
1407-
var docMode = document.documentMode || 0;
1408-
if (docMode < 8) {
1406+
if ((document.documentMode || 0) < 8) {
14091407
var frame = document.createElement(
14101408
'<iframe src="javascript:0" style="display:none" tabindex="-1">'
14111409
);
1412-
this.iframe = body.appendChild(frame).contentWindow;
1410+
var body = document.body;
1411+
this.iframe = body.insertBefore(frame, body.firstChild).contentWindow;
1412+
if (this._wantsHashChange) this.navigate(fragment);
14131413
}
14141414
} catch(e){}
14151415

1416-
if (this.iframe && this._wantsHashChange) {
1417-
this.navigate(fragment);
1418-
}
1419-
14201416
// Depending on whether we're using pushState or hashes, and whether
14211417
// 'onhashchange' is supported, determine how we check the URL state.
14221418
if (this._hasPushState && 'onpopstate' in window) {

0 commit comments

Comments
 (0)