diff --git a/src/base/single/text.js b/src/base/single/text.js index 79d10a2fc..85daaf79a 100644 --- a/src/base/single/text.js +++ b/src/base/single/text.js @@ -144,13 +144,15 @@ BI.Text = BI.inherit(BI.Single, { // 为textContext赋值为undefined时在ie和edge下会真的显示undefined this.options.text = BI.isNotNull(text) ? text : ""; if (BI.isIE9Below()) { - this.text.element.html(BI.htmlEncode(this._getShowText())); + this.text.element.html(BI.htmlEncode(BI.Text.formatText(this._getShowText()))); return; } // textContent性能更好,并且原生防xss - this.text.element[0].textContent = this._getShowText(); + this.text.element[0].textContent = BI.Text.formatText(this._getShowText()); BI.isKey(this.options.keyword) && this.doRedMark(this.options.keyword); } }); - +BI.Text.formatText = function (text) { + return text; +}; BI.shortcut("bi.text", BI.Text); diff --git a/src/base/tree/ztree/treeview.js b/src/base/tree/ztree/treeview.js index 71efa9074..2250b4fb7 100644 --- a/src/base/tree/ztree/treeview.js +++ b/src/base/tree/ztree/treeview.js @@ -32,7 +32,7 @@ BI.TreeView = BI.inherit(BI.Pane, { element: this, items: [this.tip] }); - if(BI.isNotNull(o.value)) { + if (BI.isNotNull(o.value)) { this.setSelectedValue(o.value); } if (BI.isIE9Below && BI.isIE9Below()) { @@ -111,7 +111,7 @@ BI.TreeView = BI.inherit(BI.Pane, { // 当前点击节点的状态是半选,且为true_part, 则将其改为false_part,使得点击半选后切换到的是全选 var checked = treeNode.checked; var status = treeNode.getCheckStatus(); - if(status.half === true && status.checked === true) { + if (status.half === true && status.checked === true) { checked = false; } // 更新此node的check状态, 影响父子关联,并调用beforeCheck和onCheck回调 @@ -204,7 +204,7 @@ BI.TreeView = BI.inherit(BI.Pane, { }); } // 当前点击节点的状态是半选,且为true_part, 则将其改为false_part,使得点击半选后切换到的是全选 - if(status.half === true && status.checked === true) { + if (status.half === true && status.checked === true) { treeNode.checked = false; } } @@ -333,11 +333,12 @@ BI.TreeView = BI.inherit(BI.Pane, { BI.each(ns, function (i, n) { n.title = n.title || n.text || n.value; n.isParent = n.isParent || n.parent; + n.value = n.value || n.text; // 处理标红 if (BI.isKey(o.paras.keyword)) { - n.text = BI.$("