Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Playing with Google's Closure Compiler and got a message for Prototype 1.7.0.0
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Richard Quadling  
View profile  
 More options May 17 2011, 12:24 pm
From: Richard Quadling <rquadl...@gmail.com>
Date: Tue, 17 May 2011 17:24:24 +0100
Local: Tues, May 17 2011 12:24 pm
Subject: Playing with Google's Closure Compiler and got a message for Prototype 1.7.0.0
Hi.

Using Google Maps API with Prototype. Playing putting it into Google
Closure Compiler.

Got a message  ...

Number of warnings: 1

JSC_USELESS_CODE: Suspicious code. This code lacks side-effects. Is
there a bug? at line 4437 character 3 in prototype.js
                        elem.parentNode.selectedIndex;
   ^

which is ...

        filters: {
                enabled: function(elem){
                        return elem.disabled === false && elem.type !== "hidden";
                },
                disabled: function(elem){
                        return elem.disabled === true;
                },
                checked: function(elem){
                        return elem.checked === true;
                },
                selected: function(elem){
                        elem.parentNode.selectedIndex; // <<<<<<<< line 4437
                        return elem.selected === true;
                },
                parent: function(elem){
                        return !!elem.firstChild;
                },
                empty: function(elem){
                        return !elem.firstChild;
                },

It looks like they are right? From what I know, that statement isn't
going to do anything.

To see this in action...

Go to http://closure-compiler.appspot.com/home and enter ...

// ==ClosureCompiler==
// @compilation_level SIMPLE_OPTIMIZATIONS
// @output_file_name default.js
// @code_url http://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js
// @code_url http://maps.google.com/maps/api/js?libraries=geometry&sensor=false
// ==/ClosureCompiler==

// ADD YOUR CODE HERE
alert(1);

as the code to optimize.

Choose "Simple" from the list of optimizations.

Click "Compile" and then look at the warnings tab on the right hand side.

Regards,

Richard.

--
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andrew Dupont  
View profile  
 More options May 17 2011, 1:53 pm
From: Andrew Dupont <goo...@andrewdupont.net>
Date: Tue, 17 May 2011 12:53:01 -0500
Local: Tues, May 17 2011 1:53 pm
Subject: Re: [Prototype-core] Playing with Google's Closure Compiler and got a message for Prototype 1.7.0.0
I had to look it up, because that's part of Sizzle [1], but accessing that property does have a side effect, apparently. It makes the `selected` property work correctly when something is selected by default.

That strikes me as a spurious thing for GCC to warn about — you wouldn't typically expect property access to have side effects, but with getters/setters now in JavaScript, it'll become more and more common.

Cheers,
Andrew

[1] https://github.com/jquery/sizzle/blob/master/sizzle.js#L598

On May 17, 2011, at 11:24 AM, Richard Quadling wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rick Waldron  
View profile  
 More options May 17 2011, 2:24 pm
From: Rick Waldron <waldron.r...@gmail.com>
Date: Tue, 17 May 2011 14:24:58 -0400
Local: Tues, May 17 2011 2:24 pm
Subject: Re: [Prototype-core] Playing with Google's Closure Compiler and got a message for Prototype 1.7.0.0

Andrew, Richard

Not sure if this helps, but I figured it was worth the mention... jQuery no
longer uses GCC for min/compression... but when we did, we had the warn
level set to quiet:

https://github.com/jquery/jquery/commit/d503845d0cf45632c0d7c3542ffd1...

Hopefully that's useful information :)

Rick

On Tue, May 17, 2011 at 1:53 PM, Andrew Dupont <goo...@andrewdupont.net>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nicolás Sanguinetti  
View profile  
 More options May 17 2011, 2:28 pm
From: Nicolás Sanguinetti <h...@nicolassanguinetti.info>
Date: Tue, 17 May 2011 15:28:15 -0300
Local: Tues, May 17 2011 2:28 pm
Subject: Re: [Prototype-core] Playing with Google's Closure Compiler and got a message for Prototype 1.7.0.0
I like that it warns about *lack* of side effects. I mean, any
functional programmer would think that's a great warning to have :)

-foca


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Richard Quadling  
View profile  
 More options May 18 2011, 4:22 am
From: Richard Quadling <rquadl...@gmail.com>
Date: Wed, 18 May 2011 09:22:52 +0100
Local: Wed, May 18 2011 4:22 am
Subject: Re: [Prototype-core] Playing with Google's Closure Compiler and got a message for Prototype 1.7.0.0
Using a getter to alter state sounds like a really bad idea.

Thank you all for looking at this. Glad it wasn't anything important.

OOI, the Sizzle code wraps the access in a condition. Should this be
ported to Prototype?

On 17 May 2011 18:53, Andrew Dupont <goo...@andrewdupont.net> wrote:

--
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andrew Dupont  
View profile  
 More options May 18 2011, 2:16 pm
From: Andrew Dupont <goo...@andrewdupont.net>
Date: Wed, 18 May 2011 13:16:04 -0500
Local: Wed, May 18 2011 2:16 pm
Subject: Re: [Prototype-core] Playing with Google's Closure Compiler and got a message for Prototype 1.7.0.0

On May 18, 2011, at 3:22 AM, Richard Quadling wrote:

> OOI, the Sizzle code wraps the access in a condition. Should this be
> ported to Prototype?

We'll update to the latest version of Sizzle when we release 1.7.0.1.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Richard Quadling  
View profile  
 More options May 19 2011, 4:56 am
From: Richard Quadling <rquadl...@gmail.com>
Date: Thu, 19 May 2011 09:56:48 +0100
Local: Thurs, May 19 2011 4:56 am
Subject: Re: [Prototype-core] Playing with Google's Closure Compiler and got a message for Prototype 1.7.0.0
On 18 May 2011 19:16, Andrew Dupont <goo...@andrewdupont.net> wrote:

> On May 18, 2011, at 3:22 AM, Richard Quadling wrote:

>> OOI, the Sizzle code wraps the access in a condition. Should this be
>> ported to Prototype?

> We'll update to the latest version of Sizzle when we release 1.7.0.1.

Thank you all for your time.

--
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »