提交 5a369a9e 编写于 作者: B Boris Sekachev 提交者: azhavoro

Bug has been fixed: Defiant doesn't support dash (-) in xpath nodes (#53)

上级 89cb5eb1
......@@ -26,10 +26,11 @@ class FilterModel {
lock: shape.model.lock
};
// We replace all dashes due to defiant.js can't work with it
function convertAttributes(attributes) {
let converted = {};
for (let attrId in attributes) {
converted[attributes[attrId].name.toLowerCase()] = ('' + attributes[attrId].value).toLowerCase();
converted[attributes[attrId].name.toLowerCase().replace(/-/g, "_")] = ('' + attributes[attrId].value).toLowerCase();
}
return converted;
}
......@@ -38,11 +39,11 @@ class FilterModel {
_convertCollection(collection) {
let converted = {};
for (let labelId in this._labels) {
converted[this._labels[labelId]] = [];
converted[this._labels[labelId].replace(/-/g, "_")] = [];
}
for (let shape of collection) {
converted[this._labels[shape.model.label].toLowerCase()].push(this._convertShape(shape));
converted[this._labels[shape.model.label].toLowerCase().replace(/-/g, "_")].push(this._convertShape(shape));
}
return converted;
}
......@@ -109,7 +110,7 @@ class FilterView {
this._filterString.on('change', (e) => {
let value = $.trim(e.target.value);
if (value.length) {
value = value.split('|').map(x => '/d:data/' + x).join('|').toLowerCase();
value = value.split('|').map(x => '/d:data/' + x).join('|').toLowerCase().replace(/-/g, "_");
}
if (this._controller.updateFilter(value)) {
this._filterString.css('color', 'green');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册