Re: [JSMentors] Fun interview question with function expressions

2011-09-07 Thread Dmitry Pashkevich
Dmitry, Peter, thanks a lot for the explanation! Now it's much clearer to me. -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google archive, visit here: http://www.mail-archive.com/jsmentors@go

Re: [JSMentors] spaces in attribute values

2011-09-07 Thread Nathan Sweet
Thanks Diego for the perspective. It does seem that if one wants their selector engine to be widely used that CSS is the way to go, always good to get the history of its development though. On Wed, Sep 7, 2011 at 11:08 AM, Diego Perini wrote: > I didn't understand you wanted me to say why I disli

Re: [JSMentors] spaces in attribute values

2011-09-07 Thread Diego Perini
I didn't understand you wanted me to say why I dislike XPath or what are the reasons I don't use it. I don't dislike it really. It could be as fast or faster than QSA and I believe it to be an extremely powerful technology too. However, adding to the reasons you and Austin have already given, at

Re: [JSMentors] spaces in attribute values

2011-09-07 Thread Nathan Sweet
>>I would attempt to use XPath entirely. If that is not an available option I would fall back on something else entirely and not attempt to mix parts of XPath with something unrelated. @Austin: Thanks Austin for your insight, I agree that if you can't go "whole-hog" with XPath you might as well no

[JSMentors] Re: Fun interview question with function expressions

2011-09-07 Thread SonicWizard
> All the browsers I tested IE, Chrome, FF and Opera will return the value of > the function and not 123 :) In IE 8, it alerts 123. -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google archive

Re: [JSMentors] spaces in attribute values

2011-09-07 Thread Diego Perini
Also, you can see the problem here: without quoting is 'disabled' a second class name or a second attribute name ? -- Diego On Tue, Sep 6, 2011 at 5:48 PM, Nathan Sweet wrote: >>>jQuery('[class="first last"]') >>> >>>works fine on >>> >>> > > I should amend my claim. Try it without quote

[JSMentors] Re: WebGl shape recognition

2011-09-07 Thread Diego Perini
I have just come across this example on how to handle events from shapes rendered on a canvas element. Seems the basic is working well, maybe you can take some ideas from reading the source code. http://webcodingeasy.com/JS-classes/Emulate-events-on-canvas-objects Let us know if you get tha

RE: [JSMentors] spaces in attribute values

2011-09-07 Thread Cheney, Austin
I am saying that XPath is the most ideal solution of the options that I am aware. There are valid reasons to not use XPath, such as: less familiar syntax conventions, originated as terse scripting construct of XML vocabularies, and questions about support in the wild. All modern browsers suppo

Re: [JSMentors] How to restore Object.prototype.hasOwnProperty if it has been overwritten?

2011-09-07 Thread Xavier MONTILLET
Well in my "polyfill", I did someting similare: I deleted the value to see if it changed. But there is always the case where the value is undefined and the case where you can not delete the property that make it quite hard... On Wed, Sep 7, 2011 at 2:56 PM, Asen Bozhilov wrote: > Lasse Reichstein

Re: [JSMentors] spaces in attribute values

2011-09-07 Thread Diego Perini
Nathan, 'identifier' cannot contain the plain 'space' (ascii 32) character, it MUST be escaped as '\x20', see: http://www.w3.org/TR/CSS2/syndata.html#value-def-identifier 'string' can contain the 'space' character in both escaped and unescaped forms. The meaning of the 'space' character in

Re: [JSMentors] How to restore Object.prototype.hasOwnProperty if it has been overwritten?

2011-09-07 Thread Asen Bozhilov
Lasse Reichstein: > You can use either Object.getPrototypeOf or __proto__ (with a preference on > the other, because it's not as easily modified) to check: >prop in object && !(prop in object.__proto__) > which is not same check as hasOwnProperty (if the property is both on the > object and al

Re: [JSMentors] Fun interview question with function expressions

2011-09-07 Thread Dmitry Soshnikov
On 07.09.2011 15:21, Dmitry Pashkevich wrote: On Wednesday, September 7, 2011 2:57:17 PM UTC+4, Dmitry A. Soshnikov wrote: And this variable is not read-only, you may assign to it (*while cannot to function's name*). But I can do this: function x() {}; x = 123; x; // 123 Right, beca

[JSMentors] Re: Accessors in JavaScript

2011-09-07 Thread Scott Sauyet
Bemi Faison wrote: > On Friday, September 2, 2011 5:02:26 AM UTC-7, Scott Sauyet wrote: > >> [ ... ]  Can you also choose to have immutable >> properties?  I would expect area to be only an accessor not a >> mutator.  I can't quite buy the notion of an area function that allows >> you to set the he

Re: [JSMentors] Fun interview question with function expressions

2011-09-07 Thread Poetro
2011/9/7 Dmitry Pashkevich : > On Wednesday, September 7, 2011 2:57:17 PM UTC+4, Dmitry A. Soshnikov wrote: >> >> And this variable is not read-only, you may assign to it >> (while cannot to function's name). > > But I can do this: > function x() {}; > x = 123; > x; // 123 > > I just can't understa

Re: [JSMentors] Fun interview question with function expressions

2011-09-07 Thread Dmitry Pashkevich
On Wednesday, September 7, 2011 2:57:17 PM UTC+4, Dmitry A. Soshnikov wrote: > > And this variable is not read-only, you may assign to it > (*while cannot to function's name*). > > But I can do this: function x() {}; x = 123; x; // 123 I just can't understand the environment that takes place whe

Re: [JSMentors] Fun interview question with function expressions

2011-09-07 Thread Dmitry Soshnikov
On 07.09.2011 14:49, Dmitry Pashkevich wrote: Yeah the question itself is tricky. But anyway, can somebody please give a clear explanation of why can't we override the name of the function expression if we call it immediately but this code: var x = function (){x=123;alert(x);}; x(); will ass

Re: [JSMentors] Fun interview question with function expressions

2011-09-07 Thread Dmitry Pashkevich
Yeah the question itself is tricky. But anyway, can somebody please give a clear explanation of why can't we override the name of the function expression if we call it immediately but this code: var x = function (){x=123;alert(x);}; x(); will assign 123 to x? -- To view archived discussions f

Re: [JSMentors] Fun interview question with function expressions

2011-09-07 Thread Dmitry Soshnikov
On 06.09.2011 23:37, gaz Heyes wrote: On 6 September 2011 18:38, Asen Bozhilov > wrote: will silently fail and `alert(x)' should alerting `function x(){x=123;alert(x);}`. Am I correct? Yeah you cannot overwrite "x" in the function expression unless