#1216 uvc now deletes the styles when you change the state
gitea/salix/master This commit looks good Details

This commit is contained in:
Gerard 2019-03-06 11:05:29 +01:00
parent 8e45858cd0
commit 665f34b67e
1 changed files with 19 additions and 6 deletions

View File

@ -49,13 +49,26 @@ export function directive($http, $compile, vnApp, $translate) {
}
});
let rule = selectors.join(', ') + '{display: none;}';
if ($scope.css)
document.head.removeChild($scope.css);
$scope.css = document.createElement('style');
document.head.appendChild($scope.css);
$scope.css.appendChild(document.createTextNode(rule));
if ($scope.css || document.querySelector('style[id="uvc"]')) {
let child = document.querySelector('style[id="uvc"]');
child.parentNode.removeChild(child);
}
if (selectors.length) {
let rule = selectors.join(', ') + '{display: none;}';
$scope.css = document.createElement('style');
$scope.css.setAttribute('id', 'uvc');
document.head.appendChild($scope.css);
$scope.css.appendChild(document.createTextNode(rule));
}
$scope.$on('$destroy', () => {
if ($scope.css && document.querySelector('style[id="uvc"]')) {
let child = document.querySelector('style[id="uvc"]');
child.parentNode.removeChild(child);
}
});
}
function saveConfiguration(tableConfiguration) {