Skip to main content

Bug Tracker

Side navigation

#4365 closed bug (invalid)

Opened March 17, 2009 05:14PM UTC

Closed December 02, 2010 08:07AM UTC

Last modified March 26, 2012 09:54PM UTC

prototype's getElementsByClassName causes jQuery error

Reported by: mcologne Owned by: mcologne
Priority: low Milestone: 1.3.2
Component: core Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:


i have problems using jQuery.noConflict() and firefox 2.

my firefox version: pc firefox

the same with mac firefox

i'm using only the first example from

it doesn't work, the following errors occur in firebug:

Security error" code: "1000

jQuery(document).ready is not a function

what shall i do?

anybody an idea if this is a bug?

best regards m

code i use below

<!DOCTYPE html PUBLIC "-W3CDTD XHTML 1.0 TransitionalEN" "http:">

<html xmlns="">


<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Unbenanntes Dokument</title>

<script src=""></


<script src="../scripts/jquery/jquery-1.3.2.js"></script>



Use jQuery via jQuery(...)




Use Prototype with $(...), etc.







Attachments (1)
  • jquery-1.3.2.js (118.1 KB) - added by yc_hsu May 19, 2009 12:54PM UTC.

    Inserted new code on line 2236 and 2256 to temporarily yield $ in case getElementsByClassName is overridden by Prototype which needs its own $.

Change History (10)

Changed April 28, 2009 04:30PM UTC by rjbjq comment:1

I can replicate this issue.

I merged 1.3.2 back to 1.3.1(which works fine) and the change that is causing this issue is around line 2231 of jquery-1.3.2.js. Specifically I think it is due to Firefox crashing when div.getElementsByClassName() is called on line 2236. Perhaps this is due to getElementsByClassName() being overridden by prototype?

Changed May 14, 2009 05:25PM UTC by crutchfield comment:2

I was able to get around this issue by adding a try/catch block around the offending code.

try {
if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) (function(){
	var div = document.createElement("div");
	div.innerHTML = "<div class='test e'></div><div class='test'></div>";

	// Opera can't find a second classname (in 9.6)
	if ( div.getElementsByClassName("e").length === 0 )

	// Safari caches class attributes, doesn't catch changes (in 3.2)
	div.lastChild.className = "e";

	if ( div.getElementsByClassName("e").length === 1 )

	Expr.order.splice(1, 0, "CLASS");
	Expr.find.CLASS = function(match, context, isXML) {
		if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
			return context.getElementsByClassName(match[1]);
} catch(e) {
	// If using prototype + FF2.0 this block will fail, catching the exeception and moving on
	// as FF2.0 shouldn't natively have getElementsByClassName defined

Changed October 14, 2009 03:31AM UTC by dmethvin comment:3

component: unfilledcore
summary: unable to use jQuery.noConflict() and firefox 2prototype's getElementsByClassName causes jQuery error

Changed October 28, 2010 04:49AM UTC by addyosmani comment:4

#5027 is a duplicate of this ticket.

Changed October 29, 2010 05:06AM UTC by SlexAxton comment:5

owner: → mcologne
priority: majorlow
status: newpending

Anyone still having issues with noConflict?

Changed November 07, 2010 02:56PM UTC by rwaldron comment:6

#7426 is a duplicate of this ticket.

Changed November 08, 2010 09:35PM UTC by rwaldron comment:7

#5284 is a duplicate of this ticket.

Changed December 02, 2010 08:07AM UTC by trac-o-bot comment:8

resolution: → invalid
status: pendingclosed

Automatically closed due to 14 days of inactivity.

Changed March 26, 2012 09:52PM UTC by anonymous comment:9

this is still a current issue, reopen please.

Changed March 26, 2012 09:54PM UTC by rwaldron comment:10