Fix embed DOM classes
Classes, IDs and Names in the DOM have to begin with a letter. The $$hashKey however might not, so prefix it with embed_. This also makes the classes more unique, which is a good thing. Additionally, don't scroll on undefined should that ever happen. Fixes #45
This commit is contained in:
parent
2e963da581
commit
93f40c64e9
|
@ -4,7 +4,7 @@
|
|||
Hide {{ plugin.name }}
|
||||
</button>
|
||||
|
||||
<div ng-bind-html="displayedContent" bo-class="plugin.$$hashKey"></div>
|
||||
<div ng-bind-html="displayedContent" bo-class="'embed_' + plugin.$$hashKey"></div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="plugin.visible">
|
||||
|
|
|
@ -813,8 +813,10 @@ weechat.directive('plugin', function() {
|
|||
|
||||
// Scroll embed content into view
|
||||
var scroll = function() {
|
||||
var embed = document.querySelector("." + $scope.plugin.$$hashKey);
|
||||
embed.scrollIntoViewIfNeeded();
|
||||
var embed = document.querySelector(".embed_" + $scope.plugin.$$hashKey);
|
||||
if (embed) {
|
||||
embed.scrollIntoViewIfNeeded();
|
||||
}
|
||||
};
|
||||
setTimeout(scroll, 100);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue