Bug Tracker

Ticket #11027 (closed bug: invalid)

Opened 3 years ago

Last modified 2 years ago

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:
Blocking: Blocked by:

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.

Change History

comment:1 Changed 3 years ago by rwaldron

  • Owner set to reda
  • Status changed from new to pending

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

comment:2 Changed 3 years ago by rwaldron

  • Component changed from unfiled to selector

Also, this

Version 0, edited 3 years ago by rwaldron (next)

comment:3 Changed 3 years ago by trac-o-bot

  • Status changed from pending to closed
  • Resolution set to invalid

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!

comment:4 Changed 2 years ago by Inversion

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

Note: See TracTickets for help on using tickets.