@@ -229,8 +229,8 @@ function ebIndexGetComments () {
229
229
230
230
const comments = [ ]
231
231
232
- let indexedElement , commentValue , previousElementSibling ,
233
- nextElementSibling , nextSibling , targetType , targetText
232
+ let indexedElement , commentValue , nextElementSibling , nextSibling , targetType ,
233
+ targetText
234
234
235
235
// Regex for testing if a comment is an indexing comment
236
236
const isAnIndexComment = / ^ \s * i n d e x : /
@@ -267,7 +267,6 @@ function ebIndexGetComments () {
267
267
while ( treeWalker . nextNode ( ) ) {
268
268
if ( isAnIndexComment . test ( treeWalker . currentNode . nodeValue ) ) {
269
269
nextSibling = treeWalker . currentNode . nextSibling
270
- previousElementSibling = treeWalker . currentNode . previousElementSibling
271
270
nextElementSibling = treeWalker . currentNode . nextElementSibling
272
271
273
272
// If the previous or next sibling elements of the comment
@@ -279,10 +278,8 @@ function ebIndexGetComments () {
279
278
// then we know that the index target must be inline, i.e.
280
279
// inside a text element like a paragraph.
281
280
282
- if ( previousElementSibling !== null &&
283
- nextElementSibling !== null &&
284
- ebIndexOptions . blockLevelElements . includes ( previousElementSibling . tagName ) &&
285
- ebIndexOptions . blockLevelElements . includes ( nextElementSibling . tagName ) ) {
281
+ if ( nextElementSibling !== null &&
282
+ ebIndexOptions . blockLevelElements . includes ( nextElementSibling . tagName ) ) {
286
283
indexedElement = treeWalker . currentNode . nextElementSibling
287
284
targetType = 'element'
288
285
targetText = ''
@@ -319,13 +316,10 @@ function ebIndexGetComments () {
319
316
if ( thisNode . nodeType === Node . COMMENT_NODE &&
320
317
isAnIndexComment . test ( thisNode . nodeValue ) ) {
321
318
nextSibling = thisNode . nextSibling
322
- previousElementSibling = thisNode . previousElementSibling
323
319
nextElementSibling = thisNode . nextElementSibling
324
320
325
- if ( previousElementSibling !== null &&
326
- nextElementSibling !== null &&
327
- ebIndexOptions . blockLevelElements . includes ( previousElementSibling . tagName ) &&
328
- ebIndexOptions . blockLevelElements . includes ( nextElementSibling . tagName ) ) {
321
+ if ( nextElementSibling !== null &&
322
+ ebIndexOptions . blockLevelElements . includes ( nextElementSibling . tagName ) ) {
329
323
indexedElement = thisNode . nextElementSibling
330
324
targetType = 'element'
331
325
targetText = ''
0 commit comments