facebook

JavaScript: A dot following a number *is* decimal point!

  1. MyEclipse Archived
  2.  > 
  3. Web Development (HTML, CSS, etc.)
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #261972 Reply

    Is there any way to disable the bogus JavaScript warning “A dot following a number can be confused with a decimal point”?

    
            var dialog = new YAHOO.widget.SimpleDialog("internalError", {
    ****      effect: {effect:YAHOO.widget.ContainerEffect.FADE, duration: 0.25}, 
                fixedcenter:true, 
                modal:true, 
                draggable:false
            });
    

    (The flagged line is marked with ****).

    Version: 5.1.0 GA
    Build id: 20061111-5.1.0-GA

    Thanks.

    #262037 Reply

    Riyad Kalla
    Member

    MrFeinberg,
    I believe it just wants you to quote the value, that will make it happy.

    #262047 Reply

    @support-rkalla wrote:

    I believe it just wants you to quote the value, that will make it happy.

    Why would I want to quote a numeric literal? The ECMAScript spec says that an object literal is

    ObjectLiteral :
        {}
        { PropertyNameAndValueList }
    
    PropertyNameAndValueList :
        PropertyName : AssignmentExpression
        PropertyNameAndValueList , PropertyName : AssignmentExpression
    
    PropertyName :
        Identifier
        StringLiteral
        NumericLiteral 
    
    AssignmentExpression :
        ConditionalExpression
        LeftHandSideExpression AssignmentOperator AssignmentExpression 
    

    And ConditionalExpression ultimately bottoms out in

    PrimaryExpression :
        this
        Identifier
        Literal
        ArrayLiteral
        ObjectLiteral
        ( Expression ) 
    

    where Literal includes numeric literals. So, seeing as my syntax is good, why would I want to use the wrong type? I believe this is a bug in the validator, plain and simple.

    #262052 Reply

    Riyad Kalla
    Member

    My appologies, I agree it looks to be a bug, I was trying to find a quick workaround for you.

    #274027 Reply

    jyutzler
    Member

    Yet here we are in version 5.5.1 and we still have this stupid warning, yet the validator still can’t identify an extraneous comma that makes IE collapse in a heap. It makes me wonder if we are in 2007 or 1977.

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: JavaScript: A dot following a number *is* decimal point!

You must be logged in to post in the forum log in