Bug Tracker

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#9627 closed bug (wontfix)

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

Reported by: samuel@… 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) })

Change History (6)

comment:1 Changed 8 years ago by anonymous

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) })

comment:2 Changed 8 years ago by Rick Waldron

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

comment:3 in reply to:  2 Changed 8 years ago by samuel@…

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

comment:4 Changed 8 years ago by Rick Waldron

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

comment:5 in reply to:  4 Changed 8 years ago by samuel@…

Also completely stops jquery working in Safari 5.0.5

comment:6 Changed 8 years ago by Rick Waldron

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.

Note: See TracTickets for help on using tickets.