An other CDATA issue

For general web development questions that are not specifically related to CSS HTML Validator. This includes (but is not limited to) general HTML, CSS, Accessibility, JavaScript, and SEO questions.
Post Reply
User avatar
Lou
Rank V - Professional
Posts: 297
Joined: Fri Jul 29, 2005 5:55 pm
Location: CO
Contact:

An other CDATA issue

Post by Lou »

I think I have this stripped down. When I run this through the Validator (10.01) I get the following warning:
[JavaScript] lint warning: missing semicolon
for the window.onunload = function() line inside the CDATA script.

Now if I add a semicolon before that line the warning goes away. ??? any help?

My real problem is that I am trying to add Facebook "Like" buttons to a phpBB forum I an developing.
[DELETE = this is not related I fine]
These functions, from phpBB 3.0.8, cause the Facebook functions to run in an infinite loop Only in Firefox. When you click the Facebook "like" button Facebook pops up a window so you can signin to facebook. That window pops up & closes infinitely. This does not happen in other browsers - current IE, Safari, Chrome or Opera.
[/DELETE]
Knowing how the pointing finger thing can go I am trying to localize problems before I get to they "don't play well together." :?

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-gb" xml:lang="en-gb">
<head>

<meta http-equiv="content-type" content="text/html; charset=UTF-8" />

<script type="text/javascript">
// <![CDATA[
	var jump_page = 'Enter the page number you wish to go to:';
	var on_page = '1';
	var per_page = '';
	var base_url = '';
	var style_cookie = 'phpBBstyle';
	var style_cookie_settings = '; path=/; domain=www2.knob.com';
	var onload_functions = new Array();
	var onunload_functions = new Array();

	/**
	* New function for handling multiple calls to window.onload and window.unload by pentapenguin
	*/

	window.onload = function()
	{
		for (var i = 0; i < onload_functions.length; i++)
		{
			eval(onload_functions[i]);
		}
	}

	window.onunload = function()
	{
		for (var i = 0; i < onunload_functions.length; i++)
		{
			eval(onunload_functions[i]);
		}
	}

// ]]>
</script>

</head>

<body>
</body>
</html>
Lou
Say what you will about Sisyphus. He always has work.
User avatar
Albert Wiersch
Site Admin
Posts: 3785
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: An other CDATA issue

Post by Albert Wiersch »

Hi Lou,

I'm sorry for the delay.

I think you should add a couple of semicolons to end the assignment statements:

Code: Select all

       window.onload = function()
       {
          for (var i = 0; i < onload_functions.length; i++)
          {
             eval(onload_functions[i]);
          }
       };

       window.onunload = function()
       {
          for (var i = 0; i < onunload_functions.length; i++)
          {
             eval(onunload_functions[i]);
          }
       };
It seems that the JavaScript Lint messages weren't very good at pointing out the location of the missing semicolons, but I think it was referring to the above.
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
User avatar
Lou
Rank V - Professional
Posts: 297
Joined: Fri Jul 29, 2005 5:55 pm
Location: CO
Contact:

Re: An other CDATA issue

Post by Lou »

Thanks Albert.
However, I'm still in search of a fix. The facebook development/documentation/forum has not provided any additional info and seems to be full of unanswered "it doesn't work" type post. If I weren't doing this for someone else I would move on.
Lou
Say what you will about Sisyphus. He always has work.
User avatar
Albert Wiersch
Site Admin
Posts: 3785
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: An other CDATA issue

Post by Albert Wiersch »

Lou wrote:Thanks Albert.
However, I'm still in search of a fix. The facebook development/documentation/forum has not provided any additional info and seems to be full of unanswered "it doesn't work" type post. If I weren't doing this for someone else I would move on.
So the real issue is the infinite loop in Firefox? I wish I could help with that but I am not familiar with Facebook scripting.

You may one to post your question in the phpBB support forums (http://www.phpbb.com/community/index.php) since it doesn't seem you're getting much help from the Facebook forums.

I hope that adding the semicolons at least took care of the JavaScript Lint issues.
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
User avatar
Lou
Rank V - Professional
Posts: 297
Joined: Fri Jul 29, 2005 5:55 pm
Location: CO
Contact:

Re: An other CDATA issue

Post by Lou »

Albert Wiersch wrote:You may one to post your question in the phpBB support forums
Also frustrating results.
http://www.phpbb.com/community/viewtopi ... #p12931499
Interestingly some in an effort to help discover their implementation does not work in all browsers either.
Lou
Say what you will about Sisyphus. He always has work.
Post Reply