下面是一些用于bootstrap树切换元素的HTML。您可以看到第二个子列表包含已关闭的类。
<ul id="tree_menu" class="tree">
<li>
<input id="74" type="checkbox" data-name="superheros" name="tree_menu_radio" checked="checked">
<a class="tree-toggle" href="#" data-role="branch" data-toggle="branch">superheros</a>
<ul class="branch in">
<li>
<input id="75" type="checkbox" data-name="first_appeared_in_issue" name="tree_menu_radio">
<a class="tree-toggle closed" href="#" data-role="branch" data-toggle="branch">first_appeared_in_issue</a>
</li>
</ul>
</li>
</ul>
这适用于Firefox,但是在Safari扩展工程中,但是当你尝试收缩一个元素时,契约会抛出错误(展开工作):
[Error] TypeError: Attempted to assign to readonly property.
(anonymous function) (bootstrap-tree.js, line 420)
dispatch (jquery-1.8.3.min.js, line 2)
u (jquery-1.8.3.min.js, line 2)