jqeury.mmenu fires 'Syntax error, unrecognized expression' for href="#..."

1k views Asked by At

When using href='#/' or any other href starting with '#' in jquery.mmenu plugin the following exception is fired:

Syntax error, unrecognized expression: #

HTML

<body>
  <nav id="my-menu">
    <ul>
      <li><a href="#/">Home</a></li>
      <li><a href="#/about/">About us</a></li>
      <li><a href="#/contact/">Contact</a></li>
    </ul>
  </nav>
  <div>
    <div id="my-header">
      <a href="#my-menu">Open the menu</a>
    </div>
  </div>
</body>

JS

$(document).ready(function() {$("#my-menu").mmenu();});

Although the execution is not affected and the page loads as expected in all cases the error is really annoying. See the fiddle: Open the menu -> Home see the console.

Posted an issue on github but looking for any workarounds meanwhile

UDPATE

The issue is resolved in 5.3.1

1

There are 1 answers

1
nobe4 On

I think it is a sizzle specific error.

Look at this jsfiddle.

console.log(Sizzle(".a"));
console.log(Sizzle("#/about/"));

This is the same error, i think it means that the selector is not valid. Based on This article I can confirm that the selector is not valid.

enter image description here

So here is your problem :)