Skip to content

Commit 37b7eaf

Browse files
fbuchingermarijnh
authored andcommitted
make preview example work in IE 7/8
1 parent 4d59828 commit 37b7eaf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

demo/preview.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ <h1>CodeMirror 2: HTML5 preview</h1>
3636
<meta charset=utf-8>
3737
</head>
3838
<body>
39+
<p>Canvas pane goes here:</p>
3940
<canvas id=tutorial width=250 height=250></canvas>
4041
<script>
4142
var canvas = document.getElementById('tutorial');
@@ -64,7 +65,8 @@ <h1>CodeMirror 2: HTML5 preview</h1>
6465
});
6566

6667
function updatePreview() {
67-
var preview = document.getElementById('preview').contentDocument;
68+
var previewFrame = document.getElementById('preview');
69+
var preview = previewFrame.contentDocument || previewFrame.contentWindow.document;
6870
preview.open();
6971
preview.write(editor.getValue());
7072
preview.close();

0 commit comments

Comments
 (0)