[ 4 posts ]

josecan

  • Joined: Thu Sep 20, 2012 6:33 am
  • Posts: 2
  • Offline
  • Profile

Problem compressing files containing .final() tag

Post Posted: Thu Sep 20, 2012 6:42 am
+0-
Hi all,
I have a problem when using YUI compressor for compressing JS files.

I Have a switch statement including a .final() tag on it

Code:
switch (weekOfMonth.toString()) {
            case '1': // First week
                outputDate = begda.first();
                break;
            case '2': // Second week
                outputDate = begda.second();
                break;
            case '3': // Third week
                outputDate = begda.third();
                break;
            case '4': // Fourth week
                outputDate = begda.fourth();
                break;     
            case '5': // Last week
                outputDate = [b]begda.final();[/b]
                break;
        }


If I try to compress that code YUI is returning an error (even using the online version http://refresh-sf.com/yui/)

If I remove only the last 'l' in the word "final" then it works fine so if I have:

Code:
switch (weekOfMonth.toString()) {
            case '1': // First week
                outputDate = begda.first();
                break;
            case '2': // Second week
                outputDate = begda.second();
                break;
            case '3': // Third week
                outputDate = begda.third();
                break;
            case '4': // Fourth week
                outputDate = begda.fourth();
                break;     
            case '5': // Last week
                outputDate = [b]begda.fina();[/b]
                break;
        }


It works!!!

Do you have an idea on what's happening?

Thanks for your time.
Kr, Jose

John Lindal

YUI Contributor

  • Username: jafl
  • Joined: Mon Nov 02, 2009 2:33 pm
  • Posts: 352
  • Location: Los Angeles, CA
  • Twitter: jafl5272
  • GitHub: jafl
  • Gists: jafl
  • Online
  • Profile

Re: Problem compressing files containing .final() tag

Post Posted: Mon Sep 24, 2012 8:46 am
+0-
"final" is a reserved keyword, and should not be used as a function name:

https://developer.mozilla.org/en-US/doc ... rved_Words

josecan

  • Joined: Thu Sep 20, 2012 6:33 am
  • Posts: 2
  • Offline
  • Profile

Re: Problem compressing files containing .final() tag

Post Posted: Wed Oct 03, 2012 11:53 pm
+0-
I see finally as reserved word but not final... I think is something else.

Thanks a lot for your time.

Kr, Jose

John Lindal

YUI Contributor

  • Username: jafl
  • Joined: Mon Nov 02, 2009 2:33 pm
  • Posts: 352
  • Location: Los Angeles, CA
  • Twitter: jafl5272
  • GitHub: jafl
  • Gists: jafl
  • Online
  • Profile

Re: Problem compressing files containing .final() tag

Post Posted: Thu Oct 04, 2012 7:49 am
+0-
Others claim there are more reserved keywords:

http://javascript.about.com/library/blreserved.htm

http://www.javascripter.net/faq/reserved.htm
  [ 4 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
cron