Skip to content

Commit fae31cd

Browse files
authored
fixed bootstrap 4.2.1 href bug
Uncaught DOMException: Failed to execute 'querySelector' on 'Document': '/posts' is not a valid selector. twbs/bootstrap#27903 (comment)
1 parent 7443447 commit fae31cd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bootstrap4-navwalker.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
/**
44
* Bootstrap 4 "Navbar" component navwalker drop-in functionality for Sage 9
55
* Version: 1.0
6-
* Author: Michael W. Delaney
76
*
87
*/
98

@@ -87,7 +86,8 @@ public function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
8786
$attributes = !empty($item->attr_title) ? ' title="'.esc_attr($item->attr_title).'"' : '';
8887
$attributes .= !empty($item->target) ? ' target="'.esc_attr($item->target).'"' : '';
8988
$attributes .= !empty($item->xfn) ? ' rel="'.esc_attr($item->xfn).'"' : '';
90-
$attributes .= !empty($item->url) ? ' href="'.esc_attr($item->url).'"' : '';
89+
$attributes .= !empty($args->has_children) ? ' href="#"' : '';
90+
$attributes .= ($item->url) ? ' href="'.esc_attr($item->url).'"' : '';
9191
$attributes .= ($args->has_children) ? ' class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"' : '';
9292
$item_output = $args->before;
9393
$item_output .= '<a'.$attributes.'>';

0 commit comments

Comments
 (0)