Skip to content
This repository was archived by the owner on Feb 7, 2023. It is now read-only.

Commit c6e3033

Browse files
committed
making sure, if embedding annotations, that only one result per found selector appears
1 parent ddcbc4c commit c6e3033

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

public/styleguide/js/annotations-pattern.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ var annotationsPattern = {
5050

5151
// if an element was clicked on while the overlay was already on swap it
5252
obj = { "commentOverlay": "on", "swapOverlay": true, "el": item.el, "title": item.title, "comment": item.comment };
53-
53+
5454
}
5555

5656
}
@@ -178,8 +178,8 @@ var annotationsPattern = {
178178
for (comment in comments.comments) {
179179
var item = comments.comments[comment];
180180
var els = document.querySelectorAll(item.el);
181-
for (var i = 0; i < els.length; ++i) {
182-
annotationsPattern.embedComments(els[i],item.title,item.comment);
181+
if (els.length > 0) {
182+
annotationsPattern.embedComments(els[0],item.title,item.comment);
183183
}
184184
annotationsPattern.commentsEmbedded = true;
185185
}

0 commit comments

Comments
 (0)