Skip to search.

Breaking News Visit Yahoo! News for the latest.

×Close this window

jslint_com · This group has moved to Google Plus.

The Yahoo! Groups Product Blog

Check it out!

Group Information

  • Members: 583
  • Category: JavaScript
  • Founded: Mar 7, 2008
  • Language: English
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Messages

Advanced
Messages Help
Messages 1567 - 1596 of 3202   Oldest  |  < Older  |  Newer >  |  Newest
Messages: Show Message Summaries Sort by Date ^  
#1567 From: "James" <jacob@...>
Date: Mon Nov 1, 2010 8:24 pm
Subject: use strict
jpdavenportjr
Send Email Send Email
 
I run all my JavaScript through a strict version of JSLint, run it with a
careful eye toward any warning messages found in Firebug, and I think my code is
quite good.  What advantage is there to adding "use strict" to the top of my
code?  Will it catch errors I'm not already catching?  Will it actually run
faster or parse better in any browsers?

Thanks,
   James

#1568 From: "Rob Richardson" <erobrich@...>
Date: Tue Nov 2, 2010 5:57 pm
Subject: RE: [jslint] use strict
erobrich@...
Send Email Send Email
 
"use strict" identifies you're opting into the ECMAScript 5 mode of the same
name.

Rob


-----Original Message-----
From: jslint_com@yahoogroups.com [mailto:jslint_com@yahoogroups.com] On
Behalf Of James
Sent: Monday, November 01, 2010 1:25 PM
To: jslint_com@yahoogroups.com
Subject: [jslint] use strict

I run all my JavaScript through a strict version of JSLint, run it with a
careful eye toward any warning messages found in Firebug, and I think my
code is quite good.  What advantage is there to adding "use strict" to the
top of my code?  Will it catch errors I'm not already catching?  Will it
actually run faster or parse better in any browsers?

Thanks,
   James

#1569 From: "James" <jacob@...>
Date: Wed Nov 3, 2010 1:34 pm
Subject: Re: [jslint] use strict
jpdavenportjr
Send Email Send Email
 
Yes, I understand.  But why should I?  If I always drive the speed limit, why
should I put a speed regulator on my car?  There may very well be a reason, I
just want to know what advantage there is for me.

--- In jslint_com@yahoogroups.com, "Rob Richardson" <erobrich@...> wrote:
>
> "use strict" identifies you're opting into the ECMAScript 5 mode of the same
> name.
>
> Rob

#1570 From: Luke Page <luke.a.page@...>
Date: Wed Nov 3, 2010 1:46 pm
Subject: Re: [jslint] use strict
page.luke...
Send Email Send Email
 
ECMAScript 5 may be (negligably) faster, but the main benefit you get is in
using/preparing to use a language that is more sane and developed and is the
future of JavaScript. I'm sure you'll find lots of links as to the
advantages if you google it. It shouldn't make your code slower.

On 3 November 2010 13:34, James <jacob@...> wrote:

>
>
> Yes, I understand. But why should I? If I always drive the speed limit, why
> should I put a speed regulator on my car? There may very well be a reason, I
> just want to know what advantage there is for me.
>
>
> --- In jslint_com@yahoogroups.com <jslint_com%40yahoogroups.com>, "Rob
> Richardson" <erobrich@...> wrote:
> >
> > "use strict" identifies you're opting into the ECMAScript 5 mode of the
> same
> > name.
> >
> > Rob
>
>
>


[Non-text portions of this message have been removed]

#1571 From: Joshua Bell <josh@...>
Date: Wed Nov 3, 2010 5:15 pm
Subject: Re: [jslint] use strict
inexorabletash
Send Email Send Email
 
On Wed, Nov 3, 2010 at 6:34 AM, James <jacob@...> wrote:

> Yes, I understand.  But why should I?  If I always drive the speed limit,
> why should I put a speed regulator on my car?  There may very well be a
> reason, I just want to know what advantage there is for me.


This post has a reasonable summary:

http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/

In browsers today, the use strict directive does nothing.

In future browsers, the use strict directive will cause subtly different
behavior in parts of ECMAScript you probably shouldn't be using anyway.
JSLint attempts to warn you about some of those. Tracking es-discuss, it
does not appear that there are any fully conforming ES5 implementations, so
it is not possible to verify that your scripts are, in fact, strict-mode
compliant. (That is, that they behave as you would expect.)

IMHO, unless you are aware of the differences to the language that strict
mode introduces, the safest thing to do at this point is to ask JSLint (or
similar tools) to look for strict mode violations, but not deploy with a
"use strict" directive.

-- Josh


[Non-text portions of this message have been removed]

#1572 From: Mark Volkmann <r.mark.volkmann@...>
Date: Thu Nov 4, 2010 1:50 pm
Subject: ES5 and constructors
mark_volkmann
Send Email Send Email
 
I've combed the web for answers to these questions, but haven't found
them ... even in the ES5 spec which surely contains the answers.
In ES5 what is the definition of a constructor. Is it just a function
whose name begins with an uppercase letter?
Is it always an error to invoke a constructor function without using
the new keyword, or is that only an error in strict mode?

--
R. Mark Volkmann
Object Computing, Inc.

#1573 From: Mark Volkmann <r.mark.volkmann@...>
Date: Thu Nov 4, 2010 2:01 pm
Subject: ES5 access to global object
mark_volkmann
Send Email Send Email
 
I've read that in ES5, accessing the global object is a runtime error.
Can someone explain what "accessing the global object" means? Does it
mean that "this" cannot be used outside methods?

--
R. Mark Volkmann
Object Computing, Inc.

#1574 From: "seank_com" <home@...>
Date: Thu Nov 4, 2010 6:04 pm
Subject: Re: ES5 and constructors
seank_com
Send Email Send Email
 
From my understanding calling a constructor without using new will mena the this
pointer point to the global object and all the member function and varialbes you
think you're adding to the object will actually be added to the global
namespace. JSLint imposes a pattern that constructor always begin with a capital
leter and other function do not. Then it checks that functions with capital
letters are always used with new, thus avoiding the problem above.

SeanK

--- In jslint_com@yahoogroups.com, Mark Volkmann <r.mark.volkmann@...> wrote:
>
> I've combed the web for answers to these questions, but haven't found
> them ... even in the ES5 spec which surely contains the answers.
> In ES5 what is the definition of a constructor. Is it just a function
> whose name begins with an uppercase letter?
> Is it always an error to invoke a constructor function without using
> the new keyword, or is that only an error in strict mode?
>
> --
> R. Mark Volkmann
> Object Computing, Inc.
>

#1575 From: Mark Volkmann <r.mark.volkmann@...>
Date: Thu Nov 4, 2010 6:42 pm
Subject: Re: [jslint] Re: ES5 and constructors
mark_volkmann
Send Email Send Email
 
Thanks! I'm trying to verify though that in ES5, not just in JSLint, the
definition of a constructor is "a function whose name starts with an
uppercase letter".

On Thu, Nov 4, 2010 at 1:04 PM, seank_com <home@...> wrote:

>
>
> From my understanding calling a constructor without using new will mena the
> this pointer point to the global object and all the member function and
> varialbes you think you're adding to the object will actually be added to
> the global namespace. JSLint imposes a pattern that constructor always begin
> with a capital leter and other function do not. Then it checks that
> functions with capital letters are always used with new, thus avoiding the
> problem above.
>
> SeanK
>
>
> --- In jslint_com@yahoogroups.com <jslint_com%40yahoogroups.com>, Mark
> Volkmann <r.mark.volkmann@...> wrote:
> >
> > I've combed the web for answers to these questions, but haven't found
> > them ... even in the ES5 spec which surely contains the answers.
> > In ES5 what is the definition of a constructor. Is it just a function
> > whose name begins with an uppercase letter?
> > Is it always an error to invoke a constructor function without using
> > the new keyword, or is that only an error in strict mode?
> >
> > --
> > R. Mark Volkmann
> > Object Computing, Inc.
> >
>
>
>



--
R. Mark Volkmann
Object Computing, Inc.


[Non-text portions of this message have been removed]

#1576 From: Stefan Weiss <weiss@...>
Date: Thu Nov 4, 2010 8:40 pm
Subject: Re: [jslint] Re: ES5 and constructors
weiss@...
Send Email Send Email
 
On 04/11/10 19:42, Mark Volkmann wrote:
> Thanks! I'm trying to verify though that in ES5, not just in JSLint, the
> definition of a constructor is "a function whose name starts with an
> uppercase letter".

In ES5 (same as in ES3), a constructor is simply a function which
creates and initializes objects. Letter case has nothing to do with it.
Starting function names with an uppercase letter is just a common
convention to distinguish their role as constructors from other
non-constructor functions.


stefan

#1577 From: "Cheney, Edward A SSG RES USAR USARC" <austin.cheney@...>
Date: Fri Nov 5, 2010 2:12 pm
Subject: Bad escapement.
sandyhead25
Send Email Send Email
 
Using JavaScript I am attempting to forcefully inject double quote characters
into the parentheses of url fragments in CSS, so that url(jslint.com) becomes
url("jslint.com").  To keep from breaking complex URIs I am replacing
parenthesis characters that are escaped with a forward slash with an arbitrary
string:

y = y.replace(/\\\)/g, "~PDpar~");

When I am done with my function I need to return the escaped parentheses back
into the code, so logically I am using:

y = y.replace(/~PDpar~/g, "\\\)");

JSLint throws an error when "\)" is present in the second argument of a replace
method.  Is there a string equivalent that can be used which will not throw a
fit?  I understand I could simply throw a function in there which returns a
static string to prevent JSLint from directly associating the problematic string
with the replacement method, but arbitrary function calls is less efficient for
the interpreter.

Thanks,

Austin Cheney, CISSP
http://prettydiff.com/

#1578 From: Harry Whitfield <g7awz@...>
Date: Fri Nov 5, 2010 2:30 pm
Subject: Re: [jslint] Bad escapement.
harry152566
Send Email Send Email
 
On 5 Nov 2010, at 14:12:22, Cheney, Edward A SSG RES USAR USARC wrote:

> Using JavaScript I am attempting to forcefully inject double quote characters
into the parentheses of url fragments in CSS, so that url(jslint.com) becomes
url("jslint.com"). To keep from breaking complex URIs I am replacing parenthesis
characters that are escaped with a forward slash with an arbitrary string:
>
> y = y.replace(/\\\)/g, "~PDpar~");
>
> When I am done with my function I need to return the escaped parentheses back
into the code, so logically I am using:
>
> y = y.replace(/~PDpar~/g, "\\\)");
>
> JSLint throws an error when "\)" is present in the second argument of a
replace method. Is there a string equivalent that can be used which will not
throw a fit? I understand I could simply throw a function in there which returns
a static string to prevent JSLint from directly associating the problematic
string with the replacement method, but arbitrary function calls is less
efficient for the interpreter.

var y = "\\)abc\\)fgh";
print(y);
y = y.replace(/\\\)/g, "~PDpar~");
print(y);
y = y.replace(/~PDpar~/g, "\\)"); // leave out the third backslash
print(y);

Output is:

\)abc\)fgh
~PDpar~abc~PDpar~fgh
\)abc\)fgh

Harry.

#1579 From: Mark Volkmann <r.mark.volkmann@...>
Date: Thu Nov 4, 2010 9:11 pm
Subject: Re: [jslint] Re: ES5 and constructors
mark_volkmann
Send Email Send Email
 
But I read that invoking a constructor in ES5 without using the "new"
keyword is an error. If that is true then there must be some way to
distinguish between constructor functions and non-constructor functions. If
the case of the first letter is how it is done, then it is more than just a
convention in ES5.

On Thu, Nov 4, 2010 at 3:40 PM, Stefan Weiss <weiss@...> wrote:

>
>
> On 04/11/10 19:42, Mark Volkmann wrote:
> > Thanks! I'm trying to verify though that in ES5, not just in JSLint, the
> > definition of a constructor is "a function whose name starts with an
> > uppercase letter".
>
> In ES5 (same as in ES3), a constructor is simply a function which
> creates and initializes objects. Letter case has nothing to do with it.
> Starting function names with an uppercase letter is just a common
> convention to distinguish their role as constructors from other
> non-constructor functions.
>
> stefan
>
>
>



--
R. Mark Volkmann
Object Computing, Inc.


[Non-text portions of this message have been removed]

#1580 From: Stefan Weiss <weiss@...>
Date: Tue Nov 9, 2010 11:45 am
Subject: Re: [jslint] Re: ES5 and constructors
weiss@...
Send Email Send Email
 
Mark Volkmann wrote:
> But I read that invoking a constructor in ES5 without using the "new"
> keyword is an error. If that is true then there must be some way to
> distinguish between constructor functions and non-constructor functions. If
> the case of the first letter is how it is done, then it is more than just a
> convention in ES5.

The error is not caused by calling the constructor itself, but by the
attempt to use the "this value" as an object inside the constructor. In
ES3, the "this value" would be coerced to the global object, but in ES5
strict mode, that's no longer the case.

That doesn't mean that it's possible to look at a function and tell if
it's intended to be used as a constructor. For example, the function

    function foo() {}

could be used as a constructor

    var bar = new foo();

or not

    var bar = foo();

To make the purpose of the function more obvious, we use the
uppercase/lowercase convention. It's just a convention, though, not a
syntactic requirement.


stefan

#1581 From: "neonstalwart" <neonstalwart@...>
Date: Tue Nov 9, 2010 5:17 pm
Subject: incorrect error about missing space after '['
neonstalwart
Send Email Send Email
 
i have found a bug.  when running the following code through JSLint, it gives me
the error below.

/*global
	 define: false
  */
/*jslint
	 newcap: true,
	 onevar: true,
	 white: true
  */

define(['foo'], function (f) {
	 var attr = 'data-bar';

	 return f.declare([null], {
		 getList: function (e) {
			 return  f.query('['+ attr + ']', e.target);
		 }
	 });
});


Error:
Problem at line 15 character 34: Missing space after '['.

return f.query('['+ attr + ']', e.target);


i don't need to have a space after the '[' and in fact, in my use case, i need
to *not* have a space after the '['.

thanks,

ben...

#1582 From: Morgaut Alexandre Louis Marc <morgaut@...>
Date: Tue Nov 9, 2010 5:17 pm
Subject: Re: [jslint] Re: ES5 and constructors
morgaut_a
Send Email Send Email
 
A good exemple

var s = String(3); // typeof s === "string"

var s = new String(3); // typeof s === "object"

String() can be used to convert any value into a string while new String() will
create an object which constructor is String and which toString method will
return its conversion into a string value.

In ES5 strict mode, without new, when not applied as a method on an object, the
value of this can null or undefined

You can never say for sure that a function won't be used as a constructor

You just have some little tricks like...
- the function has been called once with new (then you are quite sure)
- a property has been defined on its prototype (useless on other function than
constructors)
- its first letter is upper case (convention only)
- it has a JSDoc with the tag "@constructor" (the developers probably wants you
to manage it as a constructor)
- it is a standard builtin constructor (from JS Core, DOM, BOM, ...)

>



[Non-text portions of this message have been removed]

#1583 From: "Jakob Kruse" <kruse@...>
Date: Tue Nov 9, 2010 5:19 pm
Subject: SV: [jslint] incorrect error about missing space after '['
thekrucible
Send Email Send Email
 
The error is correct. Specifically there needs to be a space between the single
quote character and the plus sign.

/Jakob


Fra: jslint_com@yahoogroups.com [mailto:jslint_com@yahoogroups.com] På vegne af
neonstalwart
Sendt: 9. november 2010 18:18
Til: jslint_com@yahoogroups.com
Emne: [jslint] incorrect error about missing space after '['


i have found a bug. when running the following code through JSLint, it gives me
the error below.

/*global
define: false
*/
/*jslint
newcap: true,
onevar: true,
white: true
*/

define(['foo'], function (f) {
var attr = 'data-bar';

return f.declare([null], {
getList: function (e) {
return f.query('['+ attr + ']', e.target);
}
});
});

Error:
Problem at line 15 character 34: Missing space after '['.

return f.query('['+ attr + ']', e.target);

i don't need to have a space after the '[' and in fact, in my use case, i need
to *not* have a space after the '['.

thanks,

ben...


[Non-text portions of this message have been removed]

#1584 From: "neonstalwart" <neonstalwart@...>
Date: Wed Nov 10, 2010 7:49 pm
Subject: Re: SV: [jslint] incorrect error about missing space after '['
neonstalwart
Send Email Send Email
 
thanks... you're right.  i don't know how i missed that.


--- In jslint_com@yahoogroups.com, "Jakob Kruse" <kruse@...> wrote:
>
> The error is correct. Specifically there needs to be a space between the
single quote character and the plus sign.
>
> /Jakob
>
>
> Fra: jslint_com@yahoogroups.com [mailto:jslint_com@yahoogroups.com] På vegne
af neonstalwart
> Sendt: 9. november 2010 18:18
> Til: jslint_com@yahoogroups.com
> Emne: [jslint] incorrect error about missing space after '['
>
>
> i have found a bug. when running the following code through JSLint, it gives
me the error below.
>
> /*global
> define: false
> */
> /*jslint
> newcap: true,
> onevar: true,
> white: true
> */
>
> define(['foo'], function (f) {
> var attr = 'data-bar';
>
> return f.declare([null], {
> getList: function (e) {
> return f.query('['+ attr + ']', e.target);
> }
> });
> });
>
> Error:
> Problem at line 15 character 34: Missing space after '['.
>
> return f.query('['+ attr + ']', e.target);
>
> i don't need to have a space after the '[' and in fact, in my use case, i need
to *not* have a space after the '['.
>
> thanks,
>
> ben...
>
>
> [Non-text portions of this message have been removed]
>

#1585 From: Erik Eckhardt <erik@...>
Date: Wed Nov 10, 2010 8:10 pm
Subject: Re: SV: [jslint] incorrect error about missing space after '['
vorpalmage
Send Email Send Email
 
I'm sure it was the confusion over reference vs. use with the single quote
marks. You read '[' as indicating only the square bracket was the thing
being complained about. Whereas " '[' " would have made it clear but been
confusing in its own way.

On Wed, Nov 10, 2010 at 11:49 AM, neonstalwart <neonstalwart@...>wrote:

>
>
> thanks... you're right. i don't know how i missed that.
>
>
> --- In jslint_com@yahoogroups.com <jslint_com%40yahoogroups.com>, "Jakob
> Kruse" <kruse@...> wrote:
> >
> > The error is correct. Specifically there needs to be a space between the
> single quote character and the plus sign.
> >
> > /Jakob
> >
> >
> > Fra: jslint_com@yahoogroups.com <jslint_com%40yahoogroups.com> [mailto:
> jslint_com@yahoogroups.com <jslint_com%40yahoogroups.com>] På vegne af
> neonstalwart
> > Sendt: 9. november 2010 18:18
> > Til: jslint_com@yahoogroups.com <jslint_com%40yahoogroups.com>
> > Emne: [jslint] incorrect error about missing space after '['
> >
> >
> > i have found a bug. when running the following code through JSLint, it
> gives me the error below.
> >
> > /*global
> > define: false
> > */
> > /*jslint
> > newcap: true,
> > onevar: true,
> > white: true
> > */
> >
> > define(['foo'], function (f) {
> > var attr = 'data-bar';
> >
> > return f.declare([null], {
> > getList: function (e) {
> > return f.query('['+ attr + ']', e.target);
> > }
> > });
> > });
> >
> > Error:
> > Problem at line 15 character 34: Missing space after '['.
> >
> > return f.query('['+ attr + ']', e.target);
> >
> > i don't need to have a space after the '[' and in fact, in my use case, i
> need to *not* have a space after the '['.
> >
> > thanks,
> >
> > ben...
> >
> >
> > [Non-text portions of this message have been removed]
> >
>
>
>


[Non-text portions of this message have been removed]

#1586 From: "pauanyu" <pcxunlimited@...>
Date: Thu Nov 11, 2010 5:47 pm
Subject: Re: incorrect error about missing space after '['
pauanyu
Send Email Send Email
 
Why wouldn't this work?

return f.query('[' + attr + ']', e.target);

--- In jslint_com@yahoogroups.com, "neonstalwart" <neonstalwart@...> wrote:
>
> i have found a bug.  when running the following code through JSLint, it gives
me the error below.
>
> /*global
>  define: false
>  */
> /*jslint
>  newcap: true,
>  onevar: true,
>  white: true
>  */
>
> define(['foo'], function (f) {
>  var attr = 'data-bar';
>
>  return f.declare([null], {
> 	 getList: function (e) {
> 		 return  f.query('['+ attr + ']', e.target);
> 	 }
>  });
> });
>
>
> Error:
> Problem at line 15 character 34: Missing space after '['.
>
> return f.query('['+ attr + ']', e.target);
>
>
> i don't need to have a space after the '[' and in fact, in my use case, i need
to *not* have a space after the '['.
>
> thanks,
>
> ben...
>

#1587 From: "pauanyu" <pcxunlimited@...>
Date: Thu Nov 11, 2010 5:54 pm
Subject: Re: Bad escapement.
pauanyu
Send Email Send Email
 
Try this regular expression:

/url\(((?:[^\)\\]|\\.)*)\)/

You would use it like so:

string.replace(regexp, "url(\"$1\")");


--- In jslint_com@yahoogroups.com, "Cheney, Edward A SSG RES USAR USARC"
<austin.cheney@...> wrote:
>
> Using JavaScript I am attempting to forcefully inject double quote characters
into the parentheses of url fragments in CSS, so that url(jslint.com) becomes
url("jslint.com").  To keep from breaking complex URIs I am replacing
parenthesis characters that are escaped with a forward slash with an arbitrary
string:
>
> y = y.replace(/\\\)/g, "~PDpar~");
>
> When I am done with my function I need to return the escaped parentheses back
into the code, so logically I am using:
>
> y = y.replace(/~PDpar~/g, "\\\)");
>
> JSLint throws an error when "\)" is present in the second argument of a
replace method.  Is there a string equivalent that can be used which will not
throw a fit?  I understand I could simply throw a function in there which
returns a static string to prevent JSLint from directly associating the
problematic string with the replacement method, but arbitrary function calls is
less efficient for the interpreter.
>
> Thanks,
>
> Austin Cheney, CISSP
> http://prettydiff.com/
>

#1588 From: "Cheney, Edward A SSG RES USAR USARC" <austin.cheney@...>
Date: Thu Nov 11, 2010 10:35 pm
Subject: Re: [jslint] Re: Bad escapement.
sandyhead25
Send Email Send Email
 
> Try this regular expression:
>
> /url\(((?:[^\)\\]|\\.)*)\)/
>
> You would use it like so:
>
> string.replace(regexp, "url(\"$1\")");
>

There are some problems with that.

1) The regexp does not account for the prior existence of single or double quote
characters that may or may not be applied in a valid manner.
2) The regexp does not appear to be accounting for open parenthesis with or
without proper escapement.
3) There are many characters that have valid syntax representation in URI and
like wise have valid syntax representation in CSS.  These characters have to be
accounted for in a manner that is not conflicting with CSS syntax and
simultaneously does not alter their application in a URI instance.

Regular expression execution is supposed to be one of the fastest forms of
execution in JavaScript against large string blocks because the execution is
performed below the JavaScript interpretation.  However, I have found that
regexp execution is only fast when it is performed outside of any loop
conditions.  When regexp execution is performed inside a loop then you suffer
dire consequences since the interpreter must fire on each loop index and halts
each time for return of independently executed regexp.  The complexity of the
regexp also plays a very big part in this lag as well.  This said if any logic
has to be applied to a regexp match where that logic requires any sort of
looping or if a regexp executes only in response to conditions in a loop then it
is best to not use regexp at all and just use standard string methods in normal
JavaScript loops.  As a result I have chosen to use regexp to escape certain
necessary characters into an arbitrary string and perform the next stages of
processing using standard string methods in a loop.  Another alternative is
nested regexp execution where a replace method searches for a match and the
replacement value fires a function that executes another regexp instruction, but
this method is less flexible and opens complexity to the depth of known test
cases.

#1589 From: "pauanyu" <pcxunlimited@...>
Date: Sat Nov 13, 2010 3:48 pm
Subject: [jslint] Re: Bad escapement.
pauanyu
Send Email Send Email
 
--- In jslint_com@yahoogroups.com, "Cheney, Edward A SSG RES USAR USARC"
<austin.cheney@...> wrote:
>
>
> > Try this regular expression:
> >
> > /url\(((?:[^\)\\]|\\.)*)\)/
> >
> > You would use it like so:
> >
> > string.replace(regexp, "url(\"$1\")");
> >
>
> There are some problems with that.
>
> 1) The regexp does not account for the prior existence of single or double
quote characters that may or may not be applied in a valid manner.

Correct. I attempted to do that with a regular expression, and I'm not sure if
it's even possible. Additional logic will likely be required to check for
already-existing quotes.

> 2) The regexp does not appear to be accounting for open parenthesis with or
without proper escapement.

With the above regular expression, the following would match:

url(foo(bar)

url(foo\(bar)

It could probably be changed to make the above invalid.

> 3) There are many characters that have valid syntax representation in URI and
like wise have valid syntax representation in CSS.  These characters have to be
accounted for in a manner that is not conflicting with CSS syntax and
simultaneously does not alter their application in a URI instance.

The above expression matches any character except a non-escaped ). That means,
that it is extremely liberal in what it accepts. If you want it to be stricter,
that would be possible as well, though it would require more work. Thus, this is
valid (as it should be):

url(ftp://www.foo.com/search?bar=%F0%9D%95%A2%F0%9D%95%A6%F0%9D%95%A9#%E2%81%98)

> As a result I have chosen to use regexp to escape certain necessary characters
into an arbitrary string and perform the next stages of processing using
standard string methods in a loop.

That is fine, just be careful because it is possible (albeit very unlikely) for
your arbitrary string to be found in the URI.

#1590 From: "Douglas Crockford" <douglas@...>
Date: Mon Nov 15, 2010 7:57 pm
Subject: JSLint on Github
douglascrock...
Send Email Send Email
 
#1591 From: Dominic Mitchell <dom@...>
Date: Mon Nov 15, 2010 9:51 pm
Subject: Re: [jslint] JSLint on Github
happygiraffe...
Send Email Send Email
 
On Mon, Nov 15, 2010 at 7:57 PM, Douglas Crockford <douglas@...>wrote:

> https://github.com/douglascrockford/JSLint
>
>
Thanks very much!  My own github mirror of jslint.com stopped a few weeks
back and I haven't gotten it up again.  This is really useful.

-Dom


[Non-text portions of this message have been removed]

#1592 From: Erik Eckhardt <erik@...>
Date: Tue Nov 16, 2010 11:28 pm
Subject: Filtered for...in
vorpalmage
Send Email Send Email
 
JSLint is complaining that my for...in loop is not filtered. The docs
suggest the following format:

for (name in obj) {
    if (obj.hasOwnProperty(name)) {
        ...
    }
}

But I am filtering my for in loops, just slightly differently:

for (name in obj) {
    if (!obj.hasOwnProperty(name)) {continue;}
    ...
  }

I like this because it avoids an extra level of indentation in my code. If I
want to add or remove this line it can be done in just a single place
instead of at the top and bottom of the loop.

Is there any way JSLint can be modified to detect this as a valid for...in
filter method?

Erik


[Non-text portions of this message have been removed]

#1593 From: "Chris" <Nielsen.Chris@...>
Date: Wed Nov 17, 2010 5:43 pm
Subject: Bug report: access of character in string by index
altearius
Send Email Send Email
 
Hello,

Line 1786 of fulljslint.js is part of an attempt to detect and validate the
closing of an HTML comment: -->.

It reads as:

if (s[i + 2] !== '>') {

https://github.com/douglascrockford/JSLint/blob/ca120a731db548c0014320fa0c196edc\
613536ae/fulljslint.js#L1786

Where "s" is a string.  Unfortunately, this method of accessing a specific
character of a string by its index is not universally supported.  In particular,
I find that it is failing in WSH.

Would you mind adjusting this to use the charAt method instead?

Thanks!

- Chris

#1594 From: "Douglas Crockford" <douglas@...>
Date: Wed Nov 17, 2010 6:02 pm
Subject: Re: Filtered for...in
douglascrock...
Send Email Send Email
 
--- In jslint_com@yahoogroups.com, Erik Eckhardt <erik@...> wrote:
>
> JSLint is complaining that my for...in loop is not filtered. The docs
> suggest the following format:
>
> for (name in obj) {
>    if (obj.hasOwnProperty(name)) {
>        ...
>    }
> }
>
> But I am filtering my for in loops, just slightly differently:
>
> for (name in obj) {
>    if (!obj.hasOwnProperty(name)) {continue;}
>    ...
>  }
>
> I like this because it avoids an extra level of indentation in my code. If I
> want to add or remove this line it can be done in just a single place
> instead of at the top and bottom of the loop.

I do not recommend use of continue. JSLint currently barely tolerates it.

#1595 From: Michael Mikowski <z_mikowski@...>
Date: Wed Nov 17, 2010 6:25 pm
Subject: Re: [jslint] Re: Filtered for...in
z_mikowski
Send Email Send Email
 
In my team code standards, continue and break are only to be used with a label.
  This is similar to other Best Practice conventions in other languages because
it avoids the ambiguity of the continue or break statement.  And sometimes, its
actually quite useful (e.g. break of an outer loop from an inner loop when a
condition is met).

Here is a contrived example:

var
   str_search_model = 'Ford Escort',
   hash_obj_car = {
     escort : { str_model : 'Ford Escort' },
     malibu : { str_model: 'Chevy Malibu'}
   },
   obj_car,
   str_key
   ;

FIND_CAR:
for ( str_key in hash_car ){
   if ( ! hash_obj_car.hasOwnProperty(str_name)){ continue FIND_CAR; }
   obj_car = hash_obj_car[str_key];
   if ( obj_car.str_model === str_search_model ){ break FIND_CAR; }
}

// and now obj_car is the 'Ford Escort' model, or if not found, undefined






________________________________
From: Douglas Crockford <douglas@...>
To: jslint_com@yahoogroups.com
Sent: Wed, November 17, 2010 10:02:35 AM
Subject: [jslint] Re: Filtered for...in


--- In jslint_com@yahoogroups.com, Erik Eckhardt <erik@...> wrote:
>
> JSLint is complaining that my for...in loop is not filtered. The docs
> suggest the following format:
>
> for (name in obj) {
>    if (obj.hasOwnProperty(name)) {
>        ...
>    }
> }
>
> But I am filtering my for in loops, just slightly differently:
>
> for (name in obj) {
>    if (!obj.hasOwnProperty(name)) {continue;}
>    ...
>  }
>
> I like this because it avoids an extra level of indentation in my code. If I
> want to add or remove this line it can be done in just a single place
> instead of at the top and bottom of the loop.

I do not recommend use of continue. JSLint currently barely tolerates it.




[Non-text portions of this message have been removed]

#1596 From: "Douglas Crockford" <douglas@...>
Date: Wed Nov 17, 2010 6:31 pm
Subject: Re: Bug report: access of character in string by index
douglascrock...
Send Email Send Email
 
--- In jslint_com@yahoogroups.com, "Chris" <Nielsen.Chris@...> wrote:
> Line 1786 of fulljslint.js is part of an attempt to detect and validate the
closing of an HTML comment: -->.
>
> It reads as:
>
> if (s[i + 2] !== '>') {
>
https://github.com/douglascrockford/JSLint/blob/ca120a731db548c0014320fa0c196edc\
613536ae/fulljslint.js#L1786
>
> Where "s" is a string.  Unfortunately, this method of accessing a specific
character of a string by its index is not universally supported.  In particular,
I find that it is failing in WSH.
>
> Would you mind adjusting this to use the charAt method instead?

Please try it now.

Messages 1567 - 1596 of 3202   Oldest  |  < Older  |  Newer >  |  Newest
Add to My Yahoo!      XML What's This?

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help