Skip to main content

Bug Tracker

Side navigation

#9627 closed bug (wontfix)

Opened June 20, 2011 08:21PM UTC

Closed June 20, 2011 08:47PM UTC

Last modified June 21, 2011 04:29PM UTC

Adding Object.toString causes $(handler) not to run handler

Reported by: samuel@thimbleby.net Owned by:
Priority: low Milestone: 1.next
Component: support Version: 1.6.1
Keywords: Cc:
Blocked by: Blocking:
Description

Adding Object.toString causes $(handler) not to run handler

// Commenting this out removes issue

Object.prototype.toString = function() { };

Here's the jQuery

Without this, ie5 throws exception

Might be nice to do this on jQuery load failure?

try { $() } catch(e) { $ = false }

alert(true) not run

if($) $(function() { alert(true) })

Attachments (0)
Change History (6)

Changed June 20, 2011 08:27PM UTC by anonymous comment:1

Above code didn't format well, let's try this:

Adding Object.toString causes $(handler) not to run handler

//// Commenting this line out removes issue
Object.prototype.toString = function() { };

//// Here's the jQuery
// Without this line, ie5 throws exception
// Might be nice to do this on jQuery load failure?
try { $() } catch(e) { $ = false }
// alert(true) not run -- due Object.prototype.toString
if($) $(function() { alert(true) })

Changed June 20, 2011 08:47PM UTC by rwaldron comment:2

component: unfiledsupport
priority: undecidedlow
resolution: → wontfix
status: newclosed

jQuery's current browser support is as follows:

  • Chrome Current - 1
  • Safari 3+
  • Firefox 3.6.x, 4.0.x, 5.0.x
  • IE 6,7,8,9
  • Opera Current - 1

Changed June 20, 2011 11:05PM UTC by samuel@thimbleby.net comment:3

Sorry, maybe I wasn't clear

Object.prototype.toString = function() { }

Causes complete failure of jQuery in Firefox 3.6.17. i.e. no jquery works.

The secondary, more minor issue, is that attempting to load jquery into ie5.5 throws an exception. I've got no problem with jquery not working here. It would just be nice not to get exceptions

Changed June 21, 2011 03:15PM UTC by rwaldron comment:4

Writing to or configuring of Object.prototype is generally considered a bad practice and outside of jQuery's scope.

Changed June 21, 2011 04:27PM UTC by samuel@thimbleby.net comment:5

Also completely stops jquery working in Safari 5.0.5

Changed June 21, 2011 04:29PM UTC by rwaldron comment:6

Also still the same response as above.

Making changes to Object.prototype will cause unexpected behaviour across all UAs and jQuery is not responsible for that.