The blog page of my iWeb site says

when viewed on Safari


TypeError: 'undefined' is not a function

TypeError: 'undefined' is not a function


There two entries no the blog: if I press clear then the text disappear but red line stays


when viewed on Google Chrome


TypeError: Property 'y1' of object #<Object> is not a function

TypeError: Property 'y1' of object #<Object> is not a function


Again there are two entries situation on the blog: if I press clear then the text disappear but again the red line stays


Any ideas please on how I can get rid of this ugly feature on iWeb?


Thanks,


Anfi

Posted on Jul 3, 2011 12:18 PM

Reply
7 replies

Jan 12, 2012 11:10 AM in response to furnkranz

Hello all,


conerning the first error message "TypeError: 'undefined' is not a function" I got that, too in iWeb (could see in Console) and in Safari.

Investigating for a while in file Scripts/iWebBlog.js I found the reason for that behaviour:


beginning at line 168 in that file there starts a big function block beginning with:

var formatConversion={"y2":function(d,localizer){return("0"+d.getFullYear()).slice(-2);},

"y4":function(d,localizer){return("0000"+d.getFullYear()).slice(-4);},

"M4":function(d,localizer){return Date.fullMonthName(d.getMonth(),localizer);},

"M3":function(d,localizer){return Date.abbreviatedMonthName(d.getMonth(),localizer);},

"M2":function(d,localizer){return("0"+(d.getMonth()+1)).slice(-2);},

"M1":function(d,localizer){return String(d.getMonth()+1);},

"d2":function(d,localizer){return("0"+d.getDate()).slice(-2);},

"d1":function(d,localizer){return d.getDate();},

....

That function block is called a few lines later by

Date.prototype.stringWithICUDateFormat=function(format,localizer) ...

which contains a call to the above big function block in this manner:


{if(formatCode.length>0)

{var formatKey=formatCode+String(formatCount);try

{outFormat+=formatConversion[formatKey](this,localizer);}

catch(e)

{print(e);return"";}

...


Here we are: the underlined print(e) stmt prints out the error message which indeed is an exception message.

So why do we get an exception? The reason for this is that the function formatConversion is called with the formatCode "y1" which is not reflected in its big block (it begins with "y2").


To get rid of the exception I simply inserted the following stmt at the beginning of the big block:


var formatConversion={"y1":function(d,localizer){return d.getFullYear();},

"y2":function(d,localizer){return("0"+d.getFullYear()).slice(-2);},

...


That's all :-)

Hope I could help you.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

The blog page of my iWeb site says

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.