Bug Tracker

Opened 14 years ago

Closed 13 years ago

#4761 closed bug (duplicate)

hasClass() can't parse classes with newlines.

Reported by: docwhat Owned by:
Priority: major Milestone: 1.4
Component: core Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:


hasClass() doesn't properly parse classes with newlines.

Here's a simple page to reproduce it.


<div id="div1" class="one

<script type="text/javascript">
$(document).ready(function () {
  var el = $('div#div1');
  if (el.hasClass('one')) {
    el.text('No bug! Yay!');
  } else {
    el.text('The bug is present. Boo.');


Attachments (1)

jquery-1.3.2.js.diff (799 bytes) - added by pbcomm 14 years ago.
Patch, replacing line breaks with spaces

Download all attachments as: .zip

Change History (4)

comment:1 Changed 14 years ago by pbcomm

This happens on IE only.

Changed 14 years ago by pbcomm

Attachment: jquery-1.3.2.js.diff added

Patch, replacing line breaks with spaces

comment:2 Changed 14 years ago by docwhat

@pbcomm: It breaks FF 3.5betaWhatever on Mac OS X as well.

comment:3 Changed 13 years ago by dmethvin

Resolution: duplicate
Status: newclosed

Dup of #5505, which has a better patch. (This one requires \r\n in sequence.)

Note: See TracTickets for help on using tickets.