Skip to:

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#851 closed defect (fixed)

JavaScript Error: favoritesToggle[1 === isFav ? "removeClass" : "addClass"] is not a function

Reported by: timskii Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Front-end Keywords: Javascript, Ajax, favoritesToggle, topic-js.php


When logged in, examining a topic, this error occurs on page load:

favoritesToggle[1 === isFav ? "removeClass" : "addClass"] is not a function - in bb-includes/js/topic-js.php

Use Firefox+Firebug to analyse the error. Internet Explorer 7 also fails, so likely the error is not browser-specific.

The first erroneous line is:

favoritesToggle[ 1 === isFav ? 'removeClass' : 'addClass' ]( 'is-not-favorite' );

Error prevents all Ajax code related to the favourites from functioning. BBPress defaults to reloading the entire page, so favourites can still be set. However some users will experience an (annoying) error message from their browser. Developers that like working with clean code will get a headache.

Current trunk code already differs from 0.9.1 here, so this *may* already be fixed for a future release.

Change History (7)

comment:1 @so1o7 years ago

I fixed the error by adding

<?php bb_enqueue_script('jquery'); ?>

just before

<?php bb_enqueue_script('topic'); ?>

in header.php in the theme

comment:2 @sambauers7 years ago

(In [1423]) For now we will fudge it and just load jQuery. See #851

comment:3 @sambauers7 years ago

(In [1425]) Squash knock-on effect JS error in topics. See #851

comment:4 @sambauers7 years ago

Can we call this fixed since [1450] ?

comment:5 @mdawaffe7 years ago

  • Resolution set to fixed
  • Status changed from new to closed


comment:6 @mdawaffe7 years ago

  • Milestone set to 1.0-beta & XML-RPC
  • Version set to

comment:7 @mdawaffe7 years ago

  • Milestone changed from 1.0-beta & XML-RPC to 0.9.1
Note: See TracTickets for help on using tickets.