better demo
This commit is contained in:
parent
f2944d4ced
commit
ab438f2edc
3 changed files with 48 additions and 43 deletions
44
demo/ie7.html
Normal file
44
demo/ie7.html
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<title>ACE Editor StatusBar Demo</title>
|
||||
<style type="text/css" media="screen">
|
||||
/*!important without this top: 0; bottom: 0 doesn't work */
|
||||
body, html {
|
||||
position: absolute;
|
||||
top: 0px; bottom: 0; left: 0; right: 0;
|
||||
margin:0; padding:0;
|
||||
overflow:hidden
|
||||
}
|
||||
|
||||
#editor {
|
||||
margin: 0;
|
||||
position: absolute;
|
||||
top: 0; bottom: 0; left: 0; right: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<pre id="editor">
|
||||
require("ace/ext/old_ie");
|
||||
// now ace will work even on ie7!
|
||||
var editor = ace.edit("editor");
|
||||
</pre>
|
||||
|
||||
<script src="../build/src/ace.js"></script>
|
||||
<script src="../build/src/ext-old_ie.js"></script>
|
||||
<script>
|
||||
// before creating an editor patch up things for old ie
|
||||
require("ace/ext/old_ie");
|
||||
// now ace will work even on ie7!
|
||||
var editor = ace.edit("editor");
|
||||
editor.setTheme("ace/theme/textmate");
|
||||
editor.session.setMode("ace/mode/javascript");
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<title>Editor</title>
|
||||
<style type="text/css" media="screen">
|
||||
body {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#editor {
|
||||
margin: 0;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<pre id="editor">function foo(items) {
|
||||
var i;
|
||||
for (i = 0; i < items.length; i++) {
|
||||
alert("Ace Rocks " + items[i]);
|
||||
}
|
||||
}</pre>
|
||||
|
||||
<script src="../demo/kitchen-sink/require.js"></script>
|
||||
<script>
|
||||
require.config({paths:{ace: "../lib/ace"}})
|
||||
require(["ace/ace", "ace/ext/ie_quirks"], function(ace, ie_quirks) {
|
||||
require("ace/ext/ie_quirks")
|
||||
var editor = ace.edit("editor");
|
||||
editor.session.setMode("ace/mode/javascript");
|
||||
})
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -44,7 +44,8 @@ function patch(obj, name, regexp, replacement) {
|
|||
if (useragent.isIE && useragent.isIE < 10 && window.top.document.compatMode === "BackCompat")
|
||||
useragent.isOldIE = true;
|
||||
|
||||
if (typeof document != "undefined" && !document.documentElement.querySelector) {
|
||||
if (typeof document != "undefined" && !document.documentElement.querySelector) {
|
||||
useragent.isOldIE = true;
|
||||
var qs = function(el, selector) {
|
||||
if (selector.charAt(0) == ".") {
|
||||
var classNeme = selector.slice(1);
|
||||
|
|
@ -103,4 +104,6 @@ patch(
|
|||
}"
|
||||
);
|
||||
|
||||
useragent.isOldIE = true;
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue