Skip to content

Commit

Permalink
stop using top when what we want is window -- not seeing what the pur…
Browse files Browse the repository at this point in the history
…pose is, and it obviously breaks in frames
  • Loading branch information
balpha committed Aug 31, 2011
1 parent d823948 commit a37eec4
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions Markdown.Editor.js
Expand Up @@ -5,9 +5,9 @@
var util = {},
position = {},
ui = {},
doc = top.document,
re = top.RegExp,
nav = top.navigator,
doc = window.document,
re = window.RegExp,
nav = window.navigator,
SETTINGS = { lineLength: 72 },

// Used to work around some browser bugs where we can't use feature testing.
Expand Down Expand Up @@ -410,7 +410,7 @@
}

if (!uaSniffed.isIE || mode != "moving") {
timer = top.setTimeout(refreshState, 1);
timer = setTimeout(refreshState, 1);
}
else {
inputStateObj = null;
Expand All @@ -425,7 +425,7 @@
this.setCommandMode = function () {
mode = "command";
saveState();
timer = top.setTimeout(refreshState, 0);
timer = setTimeout(refreshState, 0);
};

this.canUndo = function () {
Expand Down Expand Up @@ -539,8 +539,8 @@
if (event.preventDefault) {
event.preventDefault();
}
if (top.event) {
top.event.returnValue = false;
if (window.event) {
window.event.returnValue = false;
}
return;
}
Expand Down Expand Up @@ -786,8 +786,8 @@

var result = 0;

if (top.innerHeight) {
result = top.pageYOffset;
if (window.innerHeight) {
result = window.pageYOffset;
}
else
if (doc.documentElement && doc.documentElement.scrollTop) {
Expand Down Expand Up @@ -833,7 +833,7 @@
var applyTimeout = function () {

if (timeout) {
top.clearTimeout(timeout);
clearTimeout(timeout);
timeout = undefined;
}

Expand All @@ -848,7 +848,7 @@
if (delay > maxDelay) {
delay = maxDelay;
}
timeout = top.setTimeout(makePreviewHtml, delay);
timeout = setTimeout(makePreviewHtml, delay);
}
};

Expand Down Expand Up @@ -935,12 +935,12 @@
var fullTop = position.getTop(panels.input) - getDocScrollTop();

if (uaSniffed.isIE) {
top.setTimeout(function () {
top.scrollBy(0, fullTop - emptyTop);
setTimeout(function () {
window.scrollBy(0, fullTop - emptyTop);
}, 0);
}
else {
top.scrollBy(0, fullTop - emptyTop);
window.scrollBy(0, fullTop - emptyTop);
}
};

Expand Down Expand Up @@ -1135,7 +1135,7 @@

// Why is this in a zero-length timeout?
// Is it working around a browser bug?
top.setTimeout(function () {
setTimeout(function () {

createDialog();

Expand Down Expand Up @@ -1227,8 +1227,8 @@
key.preventDefault();
}

if (top.event) {
top.event.returnValue = false;
if (window.event) {
window.event.returnValue = false;
}
}
});
Expand Down

0 comments on commit a37eec4

Please sign in to comment.