title: PrimeFaces Paginator JumpToPageDropdown Bug
body: <p>I am migrating from PrimeFaces 6.2 to 8.0. In my project I am using multiple Primeface <a href="https://www.primefaces.org/showcase/ui/data/datatable/paginator.xhtml" rel="nofollow noreferrer">DataTables with a Paginator</a>.</p>
  
  <p><strong>MCVE:</strong></p>
  
  <p>Create a data list with more than 10 elements. Then click through the different page numbers. When any page number bigger than 10 is clicked or selected from the JumpToPageDropdown the console will log the following error:</p>
  
  <p><em>Error in Chrome console:</em></p>
  
  <pre><code>jquery.js.xhtml?ln=primefaces&amp;v=8.0:2 Uncaught Error: Syntax error, unrecognized expression: option[value=\31 0]
      at Function.se.error (jquery.js.xhtml?ln=primefaces&amp;v=8.0:2)
      at se.tokenize (jquery.js.xhtml?ln=primefaces&amp;v=8.0:2)
      at se.compile (jquery.js.xhtml?ln=primefaces&amp;v=8.0:2)
      at se.select (jquery.js.xhtml?ln=primefaces&amp;v=8.0:2)
      at se (jquery.js.xhtml?ln=primefaces&amp;v=8.0:2)
      at Function.se.matches (jquery.js.xhtml?ln=primefaces&amp;v=8.0:2)
      at Function.k.filter (jquery.js.xhtml?ln=primefaces&amp;v=8.0:2)
      at k.fn.init.k.fn.&lt;computed&gt; [as children] (jquery.js.xhtml?ln=primefaces&amp;v=8.0:2)
      at c.updateUI (components.js.xhtml?ln=primefaces&amp;v=8.0:58)
      at c.updateTotalRecords (components.js.xhtml?ln=primefaces&amp;v=8.0:58)
  </code></pre>
  
  <p><em>Used component:</em></p>
  
  <pre><code>&lt;p:dataTable id="datatable"value="#{backendController.dataList}"
      var="data" paginator="true" rows="1" paginatorPosition="top"
      pageLinks="20"
      paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {JumpToPageDropdown} {NextPageLink} {LastPageLink}"&gt;
  
      -&gt; Add a few &lt;p:column&gt; tags.        
  
  &lt;/p:dataTable&gt;
  </code></pre>
  
  <p><strong>Temporary fix:</strong></p>
  
  <p>I was able to identify that JumpToPageDropdown is causing the error. When this is removed from the paginatorTemplate the error will not be shown anymore when clicking on pages greater than 10. Unfortunately I want to use this dropdown.</p>
  
  <p><strong>Further research:</strong></p>
  
  <p>PrimeFaces uses these JS files for their components and hence also for the JumpToPageDropdown:</p>
  
  <ul>
  <li>PrimeFaces 6.2: components.js.xhtml?ln=primefaces&amp;v=6.2 PrimeFaces</li>
  <li>PrimeFaces 8.0: components.js.xhtml?ln=primefaces&amp;v=8.0</li>
  </ul>
  
  <p>This are the respective calls to update the </p>
  
  <pre><code>Both versions:
  this.jtpSelect = this.jq.children(".ui-paginator-jtp-select");
  
  PrimeFaces 8.0:
  this.jtpSelect.children("option[value=" + $.escapeSelector(this.cfg.page) + "]").prop("selected", "selected")
  
  PrimeFaces 6.2:
  this.jtpSelect.children("option[value=" + (this.cfg.page) + "]").prop("selected", "selected")
  </code></pre>
  
  <p>The difference is that in version 8.0 the value of <code>this.cfg.page</code> is passed to the function <code>$.escapeSelector()</code>.</p>
  
  <p><code>this.cfg.page</code> uses zero-based numbering. Page 1 is 0, page 10 is 9 and so on. In version 6.2 <code>this.jtpSelect.children()</code> would be called with option[value=10] when the selected page is 11. But in version 8.0 <code>$.escapeSelector()</code> would format the same input to <code>\31 0</code> and results in <code>option[value=\31 0]</code>.</p>
  
  <p>This in consequence leads to the error mentioned above. See this line: <code>Uncaught Error: Syntax error, unrecognized expression: option[value=\31 0]</code></p>
  
  <p><strong>Recommendation:</strong></p>
  
  <p>If this is a bug <code>$.escapeSelector()</code> should be removed from this function in PrimeFaces 8.0, there is apparently no need for escaping: Numbers do not need to be escaped.</p>