• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

'null' is null or not an object

 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've been told this message is showing up on my company's web site. And it is... in Internet Explorer, in some applications, the yellow-triangle warning appears with this message. But not in Firefox. The code referenced in the message is this code:


This code is using jQuery, and the message 'null' is null or not an object points at Line 9, Char 2. (If that's worth anything.) Which would be this line:


Background: a couple of years ago the company's website was redesigned, and this code was part of every page. So when we inserted the web applications, we copied their boiler-plate code from the website to our apps, so they would match the look and feel of the web site. Which means that, although I'm not totally useless at Javascript and I'm not totally ignorant of jQuery, it's all a black box to me.

So can anybody tell me what I should be looking for which is making something null in that code?
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The only that strikes me as possibly being null, is the value of $('.extended').outerWidth(true). Can you check it in a debugger?
 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So I turned on Firebug and debugged that line and...

Several years ago when we wrote those web applications, we used Prototype for our AJAX processing. Then the outside company did the redesign, and they used jQuery for some UI features. So now the page contains both jQuery and Prototype. The first thing I saw when debugging was that $('.extended') called a Prototype script. Obviously this is a Bad Thing.

However almost everything in that script refers to CSS classes which don't actually exist in our pages. At any rate having it crash on the first line doesn't affect the page's behaviour in any way. So it looks like the best thing is just to remove it (and jQuery) from the page entirely.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Personally I'd remove Prototype (which is rather a dinosaur at this stage) but realize that that may not be an option for you.

P.S. jQuery and Prototype can peacefully co-exist on the same page via jQuery's $.noConflict() function.
 
reply
    Bookmark Topic Watch Topic
  • New Topic