Skip to main content

Bug Tracker

Side navigation

#11027 closed bug (invalid)

Opened December 15, 2011 12:47AM UTC

Closed December 29, 2011 07:55AM UTC

Last modified March 15, 2012 02:47PM UTC

jQuery 1.6.4 erroring with Operation is not supported“ code: ”9

Reported by: reda Owned by: reda
Priority: undecided Milestone: None
Component: selector Version: 1.6.4
Keywords: Cc:
Blocked by: Blocking:
Description

Hi,

Under iceweasel/firefox 3.5.16 I'am getting the following error in firebug: jQuery 1.6.4 :

Operation is not supported" code: "9
return !!(a.compareDocumentPosition(b) & 16);\\n  jquery.js (ligne 5139)

This bug doesn't exist with an older version of jQuery (1.3.2)

This bug doesn't exist with newer version of firefox (8)

This bug doesn't exist with Google Chrome.

The problem seems to be at line 5139 at compareDocumentPosition:

if ( document.documentElement.contains ) {
    Sizzle.contains = function( a, b ) {
        return a !== b && (a.contains ? a.contains(b) : true);
    };

} else if ( document.documentElement.compareDocumentPosition ) {
    Sizzle.contains = function( a, b ) {
        return !!(a.compareDocumentPosition(b) & 16);
    };

} else {
    Sizzle.contains = function() {
        return false;
    };
}

I just added a try-catch for the line return !!(a.compareDocumentPosition(b) & 16);

The code looks like this now:

if ( document.documentElement.contains ) {
    Sizzle.contains = function( a, b ) {
        return a !== b && (a.contains ? a.contains(b) : true);
    };

} else if ( document.documentElement.compareDocumentPosition ) {
    Sizzle.contains = function( a, b ) {
        try {
            return !!(a.compareDocumentPosition(b) & 16);
        }
        catch(e) {
            return false;
        }
    };

} else {
    Sizzle.contains = function() {
        return false;
    };
}

The bug happens when I do: element.addClass(newClass);

Thanks.

Attachments (0)
Change History (4)

Changed December 15, 2011 12:48AM UTC by rwaldron comment:1

owner: → reda
status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket!

Additionally, be sure to test against the "jQuery (edge)" version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/

Open the link and click to "Fork" (in the top menu) to get started.

keep in mind that 1.6.4 is an out of date release

Changed December 15, 2011 12:50AM UTC by rwaldron comment:2

_comment0: Also, this 1323910218212483
component: unfiledselector

Changed December 29, 2011 07:55AM UTC by trac-o-bot comment:3

resolution: → invalid
status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

Changed March 15, 2012 02:47PM UTC by Inversion comment:4

It is very hard to reproduce for the request, but it still raises in Firefox 3.5 occasionally on different sites and on different events, and not constantly, but sometimes.

You can read about what causes the problem here http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-compareDocumentPosition in the Exceptions section of compareDocumentPosition.

It is exactly that NOT_SUPPORTED_ERR case.

It is the issue even for the latest jQuery version as it still has this compareDocumentPosition usage lines without handling exceptions.

You should know, that this bug does not only alert in console with this strange message, It actually affects to the page behavior. Some event handlers are not being executed when they should.

One case with some code snippet is posted here http://stackoverflow.com/questions/6691734/jquery-1-6-2-erroring-with-operation-is-not-supported-code-9/8356466