Skip to content

Loading…

With jQuery 1.8.1, QtWebkit browsers yield "Syntax error, unrecognized expression" on selector #132

Closed
vesath opened this Issue · 7 comments

4 participants

@vesath

Consider the following HTML page:

<html>
<body>
    <table class="results">
        <thead>
            <tr>
                <th>a</th>
                <th>b</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>1</td>
                <td>2</td>
            </tr>
            <tr>
                <td>2</td>
                <td>1</td>
            </tr>
        </tbody>
    </table>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<script type="text/javascript" src="static/jquery.tablesorter.js"></script>
<script type="text/javascript">
$(document).ready(function() {
    $(".results").tablesorter();
});
</script>
</body>
</html>

Here, jquery.tablesorter.js can be either version 2.3.11 or the latest master from GIT. And note that the table element is only there so one can test whether tablesorter got successfully loaded by seeing if clicking on "a" or "b" reorders its contents.

In all QtWebkit browsers that I tested (including, for instance, Arora), the above yields:

Error: Syntax error, unrecognized expression: :not([colspan])[data-column="0"]:last,[colspan="1"][data-column="0"]:last

and reordering the table by clicking on its headers therefore does not work; however, the above works perfectly well with Gecko browsers and used to work with all browsers, including QtWebkit, with jquery-1.7.2.

I found out that it can be made to work with QtWebkit and jquery-1.8.1 by replacing the line

h = $headers.filter(':not([colspan])[data-column="' + i + '"]:last,[colspan="1"][data-column="' + i + '"]:last');

in jquery.tablesorter.js by

h = $headers.filter(':not([colspan])[data-column="'+i+'"]');

but my knowledge of selectors is too limited for me to go any further than that.

@thezoggy
Collaborator

in 1.8.x sloppy selectors now throw an error.. http://bugs.jquery.com/ticket/12368 / http://bugs.jquery.com/ticket/12299

@Mottie
Owner

Yeah, I would stick with an older version of jQuery until all of the bugs have been worked out.

I won't change that selector (except for the changes I mentioned in issue #130) because it is needed to make this demo work correctly. And the second part of that selector makes it work properly in IE8.

@toofishes

This breaks on the iPhone (iOS 5.1.1, not sure about 6.0.0), as an FYI.

JavaScript: Error
undefined
Error: Syntax error, unrecognized expression:
:not([colspan])[data-column="0"]...
@thezoggy
Collaborator

yes, known issue with 1.8.x. use 1.7.2 as they dont throw the error. or wait for 1.8.3

@toofishes

How would one know we could wait for 1.8.3 for a fix, or is that just a guess? All of the bugs linked here are currently closed; #12368 & #12299 as invalid, #12237 as fixed in 1.8.1.

@Mottie
Owner

This should now be resolved in version 2.4.7, sorry for taking so long to fix it.

@Mottie Mottie closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.