Bug Tracker

Opened 10 years ago

Closed 10 years ago

#13671 closed bug (duplicate)

Extending Object.prototype breaks jQuery 1.8.0+ in IE8 quirks mode

Reported by: anonymous Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.9.1
Keywords: Cc:
Blocked by: Blocking:

Description

Extending Object.prototype breaks at least getting elements by ID where the ID contains colons requiring escaping.

Affected browser: IE8 in quirks mode

Affected jQuery versions: 1.8.0+

<html>
  <head><title>Title</title></head>
  <body>
    <div id="id:with:colons">This is some text.</div>
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
    <script type="text/javascript">
      Object.prototype.someFunctionName = function() { };
      alert($('#id\\:with\\:colons').text());
    </script>
  </body>
</html>

Change History (4)

comment:1 Changed 10 years ago by m_gol

Resolution: notabug
Status: newclosed

You are doing two very wrong and very unsupported things - primo: extending Object.prototype is a really bad idea, lots of things can break because of that; secundo: you shouldn't write anything in quirks mode (it's 2013, come on!) and jQuery doesn't support it (and never has).

Version 0, edited 10 years ago by m_gol (next)

comment:2 Changed 10 years ago by anonymous

I don't own the code doing this but have to extend it but I was not aware that jQuery does not support quirks mode.

If somebody else runs into this problem - it works at least with jQuery 1.6 (didn't test below) and up to 1.7.2. I work around the problem by temporarily removing and later restoring the function added to Object.prototype.

comment:3 Changed 10 years ago by Rick Waldron

Resolution: notabug
Status: closedreopened

comment:4 Changed 10 years ago by Rick Waldron

Resolution: duplicate
Status: reopenedclosed
Note: See TracTickets for help on using tickets.