http://webfx.eae.net/dhtml/xloadtree/ 主頁(yè)
樹(shù)寫得不錯(cuò),但是樹(shù)有二個(gè) bug.
第一:
獲得焦點(diǎn)問(wèn)題,當(dāng)我們點(diǎn)擊樹(shù)節(jié)點(diǎn)時(shí)會(huì)獲得焦點(diǎn),然后將這個(gè)焦點(diǎn)存儲(chǔ)到全局對(duì)象中。當(dāng)點(diǎn)擊另一個(gè)焦點(diǎn)時(shí),它先判斷全局對(duì)象這個(gè)焦點(diǎn)是否存在,如果存在,則將焦點(diǎn)釋放,然后將點(diǎn)擊的焦點(diǎn)再次存儲(chǔ)到全局對(duì)象中。整個(gè)邏輯是對(duì)的,但是在IE下,有時(shí)候會(huì)出現(xiàn)多個(gè)焦點(diǎn)情況,可以肯定的說(shuō),這不是樹(shù)的 bug ,是 IE 對(duì)內(nèi)存對(duì)象管理的 bug.
第二:
<?xml version="1.0"?>
<tree>
<tree text="Load "tree1.xml"" src="tree1.xml" />
<tree text="Loaded Item 1" action="http://webfx.eae.net" />
<tree text="Loaded Item 2">
<tree text="Loaded Item 2.1" action="javascript:alert(2.1)" />
</tree>
<tree text="Loaded Item 3 (with target)" action="http://www.google.com" target="_new" />
<tree text="Load "tree1.xml"">
<tree text="Load "tree1.xml"">
</tree>
</tree>
</tree>
直接解析這段 xml 文檔,就會(huì)發(fā)現(xiàn),最后節(jié)點(diǎn)打開(kāi)后,子節(jié)點(diǎn)前面不是空白圖片。