Syntax Error jQuery v3.1.1 "el.querySelectorAll (" * ,: x ");" // line 1317

2

At the moment of opening the console and reloading the page, it sends me directly to the debugger and shows me line 1317 in red and remains loading until the console is closed.

I do not think the problem is in jQuery. I do not think he's the only one who's been through this, does anyone know the solution?

I use jQuery JavaScript Library v3.3.1:

        if ( el.querySelectorAll("[msallowcapture^='']").length ) {
            rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
        }

        // Support: IE8
        // Boolean attributes and "value" are not treated correctly
        if ( !el.querySelectorAll("[selected]").length ) {
            rbuggyQSA.push( "\[" + whitespace + "*(?:value|" + booleans + ")" );
        }

        // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
        if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
            rbuggyQSA.push("~=");
        }

        // Webkit/Opera - :checked should return selected option elements
        // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
        // IE8 throws error here and will not see later tests
        if ( !el.querySelectorAll(":checked").length ) {
            rbuggyQSA.push(":checked");
        }

        // Support: Safari 8+, iOS 8+
        // https://bugs.webkit.org/show_bug.cgi?id=136851
        // In-page 'selector#id sibling-combinator selector' fails
        if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
            rbuggyQSA.push(".#.+[+~]");
        }
    });

    assert(function( el ) {
        el.innerHTML = "<a href='' disabled='disabled'></a>" +
            "<select disabled='disabled'><option/></select>";

        // Support: Windows 8 Native Apps
        // The type and name attributes are restricted during .innerHTML assignment
        var input = document.createElement("input");
        input.setAttribute( "type", "hidden" );
        el.appendChild( input ).setAttribute( "name", "D" );

        // Support: IE8
        // Enforce case-sensitivity of name attribute
        if ( el.querySelectorAll("[name=d]").length ) {
            rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
        }

        // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
        // IE8 throws error here and will not see later tests
        if ( el.querySelectorAll(":enabled").length !== 2 ) {
            rbuggyQSA.push( ":enabled", ":disabled" );
        }

        // Support: IE9-11+
        // IE's :disabled selector does not pick up the children of disabled fieldsets
        docElem.appendChild( el ).disabled = true;
        if ( el.querySelectorAll(":disabled").length !== 2 ) {
            rbuggyQSA.push( ":enabled", ":disabled" );
        }

        // Opera 10-11 does not throw on post-comma invalid pseudos
        el.querySelectorAll("*,:x");
        rbuggyQSA.push(",.*:");
    });
}

tomar_pedido.php this is the page visible to the user

<!DOCTYPE html>
<html lang="en">
 <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
        <!-- jQuery Plugins -->
    <script src="js/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/nouislider.min.js"></script>
    <script src="js/main.js"></script>
    <!-- Bootstrap -->
    <link type="text/css" rel="stylesheet" href="css/bootstrap.min.css"/>
    <!-- nouislider -->
    <link type="text/css" rel="stylesheet" href="css/nouislider.min.css"/>
    <!-- Slick -->
    <link type="text/css" rel="stylesheet" href="css/slick.css"/>
    <link type="text/css" rel="stylesheet" href="css/slick-theme.css"/>

    <!-- Font Awesome Icon -->
    <link rel="stylesheet" href="css/font-awesome.min.css">

    <!-- Custom stlylesheet -->
    <link type="text/css" rel="stylesheet" href="css/style.css"/>

<?php
    session_start();
    include("lib/funciones.php"); 
    include("lib/conbd.php");
    valida_sesion();
    $con = conbd();
    ?>

</head>
<body>

    <!-- NAVEGACION -->
    <?php menu();?>
    <!-- /NAVIGATION -->

    <!--
    <!-- SECTION -->
    <div class="section" id="contenido">
        <!-- container -->
        <div class="container">
            <!-- row -->
            <div class="row">
                <!-- mesas -->
                <div class="col-md-4 col-xs-6">
                    <?php  

                        $sql = "SELECT * FROM mesas";
                        $result = mysqli_query($con,$sql);
                        $total_mesas =0;
                        $total_mesas = mysqli_num_rows($result);
                        if($total_mesas>0){
                            echo '<div class="listar-mesas">';
                                for($r=0;$r<$total_mesas;$r++){
                                    $row = mysqli_fetch_array($result);
                                     $idm =$row['0'];
                                     $desm =$row['1'];
                                     $numerom =$row['2'];
                                     $estadom =$row['3'];
                                     $ubim =$row['4'];
                                     //$_SESSION['mesa']=array("ID" => $idm,"DESCRIPCION" => $desm,"NUMERO" => $numerom,"ESTADO" => $estadom,"UBICACION" => $ubim);
                                    ?>
                                        <input id="btn-mesas" type="checkbox" value="<?php echo $idm;?>">
                                        <label title="<?php echo $desm; ?>" for="btn-mesas"><a class="btn mesas"></a></label>
                                        <!--<a id="mesa"data-toggle="tooltip" data-placement="top" title="<?php echo $desm; ?>" value="<?php echo $idm; ?>" class="btn mesas"><?php echo $numerom; ?></a>-->


                                        <!--     
                                         <li><a href="" id="'.$idm.'">
                                                Mesa N° '.$numerom.' 
                                                <p class="text-muted">'.$desm.'</p>
                                              </a>
                                         </li>-->
                                         <?php
                                }


                            echo '</div>';
                        }else{
                                echo"no existen mesas";
                        }
                     ?>

                </div>
                <!-- /mesas -->
                <!--detalle - productos -->
               <div class="col-md-8 col-xs-6 ">
                 <!--detalle-->
                   <div class="col-md-5">
                    <h3>Detalle</h3>
                       <form id="detalle" method="post">
                        <label>Mesa: </label><br>
                        <label>Personas: </label><br>
                        <table width="200" border="1" align="center">
                          <tr>
                            <td>QTY</td>
                            <td>Descripción</td>
                            <td>Peso</td>
                            <td>Precio</td>
                          </tr>
                          <tr>
                            <td>&nbsp;</td>
                            <td>&nbsp;</td>
                            <td>&nbsp;</td>
                            <td>&nbsp;</td>
                          </tr>
                          <tr>
                            <td>&nbsp;</td>
                            <td>&nbsp;</td>
                            <td>&nbsp;</td>
                            <td>&nbsp;</td>
                          </tr>
                          <tr>
                            <td>&nbsp;</td>
                            <td>&nbsp;</td>
                            <td>&nbsp;</td>
                            <td>&nbsp;</td>
                          </tr>
                        </table>

                        </form>
                     </div>  
                 <!--/detalle-->
                 <!--Productos-->
                 <div class="col-md-7 col-lg-7">
                 <h3>Productos</h3>
                 <div class="listar-prod">
                    <?php  
                            //obtener productos para el menu
                            $sql_prod = "SELECT * FROM 'productos";
                            $result_prod = mysqli_query($con,$sql_prod);
                            $total_prod =0;
                            $total_prod = mysqli_num_rows($result_prod);

                            if($total_prod>0){
                                    while($res=  mysqli_fetch_array($result_prod)){
                                        echo '
                                        <div class="prod">
                                            <a href=""><img src="'.$res["Productosimg"].'" width="100" heigth="100"><a>
                                        </div>
                                        ';
                                    }
                            }else{
                                    echo "no existen productos";
                            }
                        ?>
                     </div>

                 </div>
                 <!--/Productos-->
                </div>
              <!-- /detalle - productos -->
            </div>
            <!-- /row -->
        </div>
        <!-- /container -->
    </div>
    <!-- /SECTION -->



    <footer>

        <!-- bottom footer -->
        <div id="bottom-footer" class="section">
            <div class="container">
                <!-- row -->
                <div class="row">
                    <div class="col-md-12 text-center">
                        <ul class="footer-payments">
                            <li><a href="#"><i class="fa fa-cc-visa"></i></a></li>
                            <li><a href="#"><i class="fa fa-credit-card"></i></a></li>
                            <li><a href="#"><i class="fa fa-cc-paypal"></i></a></li>
                            <li><a href="#"><i class="fa fa-cc-mastercard"></i></a></li>
                            <li><a href="#"><i class="fa fa-cc-discover"></i></a></li>
                            <li><a href="#"><i class="fa fa-cc-amex"></i></a></li>
                        </ul>

                    </div>
                </div>
                    <!-- /row -->
            </div>
            <!-- /container -->
        </div>
        <!-- /bottom footer -->
    </footer>
    <!-- /FOOTER -->
<script type="text/javascript">
    $(document).ready(function(e) { 

        $("#btn-mesas").each(function () {
             $.ajax({
             type:"GET",
             url:"pedidos/select_mesa.php",
             data:{busca: $("#btn-mesas").val()},
             dataType:"html",
             success: function(){
             alert("exito");
             }

            });
        })          
    });
    
asked by Johann Sebastian Painevil Len 28.11.2018 в 00:37
source

1 answer

2

jQuery uses a series of asserts to do compatibility checks and many other things by using the next function :

function assert( fn ) {
    var el = document.createElement("fieldset");

    try {
        return !!fn( el );
    } catch (e) {
        return false;
    } finally {
        // Remove from its parent by default
        if ( el.parentNode ) {
            el.parentNode.removeChild( el );
        }
        // release memory in IE
        el = null;
    }
}

The problem you suffer is that this function causes an exception (which is captured) to check certain things in the browser or the behavior of javascript.

The line that gives you an error makes use of that method, causing An exception that is captured:

    assert(function( el ) {
        el.innerHTML = "<a href='' disabled='disabled'></a>" +
            "<select disabled='disabled'><option/></select>";

        // Support: Windows 8 Native Apps
        // The type and name attributes are restricted during .innerHTML assignment
        var input = document.createElement("input");
        input.setAttribute( "type", "hidden" );
        el.appendChild( input ).setAttribute( "name", "D" );

        // Support: IE8
        // Enforce case-sensitivity of name attribute
        if ( el.querySelectorAll("[name=d]").length ) {
            rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
        }

        // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
        // IE8 throws error here and will not see later tests
        if ( el.querySelectorAll(":enabled").length !== 2 ) {
            rbuggyQSA.push( ":enabled", ":disabled" );
        }

        // Support: IE9-11+
        // IE's :disabled selector does not pick up the children of disabled fieldsets
        docElem.appendChild( el ).disabled = true;
        if ( el.querySelectorAll(":disabled").length !== 2 ) {
            rbuggyQSA.push( ":enabled", ":disabled" );
        }

        // Opera 10-11 does not throw on post-comma invalid pseudos
        el.querySelectorAll("*,:x");
        rbuggyQSA.push(",.*:");
    });

That code does a series of checks against the HTML defined at the top.

For every check that could give problems a new rule is added to rbuggyQSA , and in the case of the last line the rbuggyQSA.push(",.*:"); will not be executed if the exception is generated.

An intelligent trick to detect if something would generate an exception, although it could have been surrounded by a try / catch equivalently:

try {
    // Opera 10-11 does not throw on post-comma invalid pseudos
    el.querySelectorAll("*,:x");
    rbuggyQSA.push(",.*:");
} catch (e) { /* no se agregará ",.*:" a rbuggyQSA */ }

The stop you suffer is because you have activated the stoppage of javascript code execution in case of exception even captured.

Depending on the browser used, the place where you can activate or deactivate this function in your debug console is the following:

  • Google Chrome: in the "Sources" tab you can find the option "Pause on exceptions" and "pause on caught exceptions".

  • Internet Explorer 11 and Windows Edge: in the "Debugger" tab, clicking on the hexagonal icon the option "Interrupt in all exceptions" (stops in those captured, can be annoying) or "Interrupt in exceptions not attended "(most recommended).

  • Firefox: in the "Debugger" tab you have in the lower part of the right frame the option "Stop in exceptions" that after being marked can be activated or deactivated "Pause the captured exceptions".

answered by 28.11.2018 в 15:44