Bug Tracker

Opened 8 years ago

Closed 6 years ago

Last modified 5 years ago

#4365 closed bug (invalid)

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 http://docs.jquery.com/Using_jQuery_with_Other_Libraries

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:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Unbenanntes Dokument</title> <script src="http://www.prototypejs.org/javascripts/prototype.js"></ script>

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


Use jQuery via jQuery(...) jQuery(document).ready(function(){



Use Prototype with $(...), etc. $('someid').hide();



<body> </body> </html>

Change History (10)

comment:1 Changed 8 years ago by rjbjq

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?

comment:2 Changed 8 years ago by crutchfield

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

comment:4 Changed 7 years ago by dmethvin

  • Component changed from unfilled to core
  • Summary changed from unable to use jQuery.noConflict() and firefox 2 to prototype's getElementsByClassName causes jQuery error

comment:5 Changed 6 years ago by addyosmani

#5027 is a duplicate of this ticket.

comment:6 Changed 6 years ago by SlexAxton

  • Owner set to mcologne
  • Priority changed from major to low
  • Status changed from new to pending

Anyone still having issues with noConflict?

comment:7 Changed 6 years ago by rwaldron

#7426 is a duplicate of this ticket.

comment:8 Changed 6 years ago by rwaldron

#5284 is a duplicate of this ticket.

comment:9 Changed 6 years ago by trac-o-bot

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

Automatically closed due to 14 days of inactivity.

comment:10 Changed 5 years ago by anonymous

this is still a current issue, reopen please.

Note: See TracTickets for help on using tickets.