Bug Tracker

Modify

Ticket #9627 (closed bug: wontfix)

Opened 2 years ago

Last modified 2 years ago

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

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

comment:1 Changed 2 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 follow-up: ↓ 3 Changed 2 years ago by rwaldron

  • Priority changed from undecided to low
  • Resolution set to wontfix
  • Status changed from new to closed
  • Component changed from unfiled to support

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 2 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 follow-up: ↓ 5 Changed 2 years ago by rwaldron

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 2 years ago by samuel@…

Also completely stops jquery working in Safari 5.0.5

comment:6 Changed 2 years ago by rwaldron

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.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.