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

Commit 0b84b6f

Browse files
author
Richard GrosJean
committed
adds custom selector support for the cleaning of the id value
1 parent 28acb29 commit 0b84b6f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/pageable.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,11 @@
177177
this.anchors = [];
178178

179179
this.pages.forEach(function(page, i) {
180-
var clean = page.dataset.anchor.replace(/\s+/, "-").toLowerCase();
180+
if (typeof page.dataset.anchor !== 'undefined') {
181+
var clean = page.dataset.anchor.replace(/\s+/, "-").toLowerCase();
182+
} else {
183+
var clean = page.classList.value.replace(/\s+/, "-").toLowerCase();
184+
}
181185
if (page.id !== clean) {
182186
page.id = clean;
183187
}

0 commit comments

Comments
 (0)