Permalink
Browse files

fix: (focusItem,removeFocus)-able in IE8

  • Loading branch information...
0mg
0mg committed Mar 10, 2012
1 parent c30cc02 commit 7604e70dcefccb7b894876021aaaa2790359771e
Showing with 39 additions and 6 deletions.
  1. +39 −6 tools/jstree/next_table.html
@@ -42,6 +42,12 @@
.iname.focus {
background: #fec;
}
+.item.unknown .iname {
+ color: gray;
+ background: transparent;
+ text-decoration: none;
+ cursor: auto;
+}
.item.object .itype {
background: #ffa;
}
@@ -65,6 +71,10 @@
color: #fff;
background: #000;
}
+.item.unknown .itype {
+ color: gray;
+ background: #fff;
+}
.item.object .ivalue,
.item.function .ivalue,
.item.undefined .ivalue {
@@ -118,7 +128,30 @@ <h1 id="cname">window</h1>
};
}
if (!Element.prototype.addEventListener) {
- Element.prototype.addEventListener = window.addEventListener;
+ HTMLDocument.prototype.addEventListener =
+ Element.prototype.addEventListener = window.addEventListener;
+}
+if (!Element.prototype.classList) {
+ Object.defineProperty(Element.prototype, "classList", {
+ get: function() {
+ var it = this;
+ var classes = it.className.replace(/\s/g, " ");
+ return {
+ contains: function(s) {
+ return (" " + classes + " ").indexOf(" " + s + " ") >= 0;
+ },
+ add: function(s) {
+ if (!this.contains(s)) it.className += " " + s;
+ },
+ remove: function(s) {
+ if (this.contains(s)) {
+ it.className = (" " + classes + " ").replace(" " + s + " ", "").
+ replace(/^\s+|\s+$/g, "");
+ }
+ }
+ };
+ }
+ });
}
if (!Array.prototype.forEach) {
Array.prototype.forEach = function(f) {
@@ -332,8 +365,8 @@ <h1 id="cname">window</h1>
value = prop.value[i];
type = value === null ? "null" : typeof value;
} catch(e) {
- value = "???";
- type = "???";
+ value = "";
+ type = "unknown";
}
this.name = fixname;
this.type = type;
@@ -370,7 +403,7 @@ <h1 id="cname">window</h1>
iname.className = "iname";
iname.appendChild(dom.ct(this.name));
- iname.addEventListener("click", function() {
+ this.type !== "unknown" && iname.addEventListener("click", function() {
openDir(prop, true);
}, false);
@@ -529,10 +562,10 @@ <h1 id="cname">window</h1>
cgo.addEventListener("click", function() {
if (address.value !== mem.getCurrent().path) goPath(address.value, true);
}, false);
- window.addEventListener("mousedown", function() {
+ document.addEventListener("mousedown", function() {
var s = dom.q(".focus");
if (s) s.classList.remove("focus");
- }, true);
+ }, false);
sort_type.addEventListener("click", function() {
var props = mem.getCurrentProps().sortProps("type");
setList(props);

0 comments on commit 7604e70

Please sign in to comment.