Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
toc_js
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
toc_js
Merge requests
!27
Issue
#3474535
by mably: fix generated html with unordered headings
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Issue
#3474535
by mably: fix generated html with unordered headings
issue/toc_js-3474535:3474535-very-odd-behaviour
into
3.0.x
Overview
0
Commits
1
Pipelines
3
Changes
1
Merged
Frank Mably
requested to merge
issue/toc_js-3474535:3474535-very-odd-behaviour
into
3.0.x
9 months ago
Overview
0
Commits
1
Pipelines
3
Changes
1
Expand
Closes
#3474535
0
0
Merge request reports
Compare
3.0.x
version 2
2371bc7d
9 months ago
version 1
aa79cb21
9 months ago
3.0.x (base)
and
latest version
latest version
2371bc7d
1 commit,
9 months ago
version 2
2371bc7d
1 commit,
9 months ago
version 1
aa79cb21
1 commit,
9 months ago
1 file
+
12
−
2
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
assets/js/tocjs.js
+
12
−
2
Options
@@ -368,8 +368,18 @@
lastLi
=
li
;
}
else
if
(
level
<
currentLevel
)
{
while
(
level
<
currentLevel
)
{
currentList
=
currentList
.
parentNode
.
parentNode
;
currentLevel
=
currentList
.
level
;
// Special case where the parent element is the root nav element.
// Can occur when the first heading is not of the highest level.
// See: https://www.drupal.org/project/toc_js/issues/3474535
if
(
currentList
.
parentNode
.
nodeName
===
'
NAV
'
)
{
if
(
level
<
currentList
.
level
)
{
currentList
.
level
=
level
;
}
break
;
}
else
{
currentList
=
currentList
.
parentNode
.
parentNode
;
currentLevel
=
currentList
.
level
;
}
}
currentList
.
appendChild
(
li
);
lastLi
=
li
;
Loading