aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes 'null' is null or not an object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark " Watch " New topic
Author

'null' is null or not an object

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18991
    
    8

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?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

The only that strikes me as possibly being null, is the value of $('.extended').outerWidth(true). Can you check it in a debugger?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18991
    
    8

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
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: 'null' is null or not an object