RE: [JSMentors] Re: getComputedStyle and marginLeft when auto

2011-05-16 Thread Joel Dart
Hey fernando, I read that part as well, but I think those are more specific cases than the one I'm dealing with. Take the following example (I defined the width of the containing block for clarity): div id=container div id=test/div /div /*css*/ #container{ width: 400px; border:

RE: [JSMentors] Re: getComputedStyle and marginLeft when auto

2011-05-16 Thread Joel Dart
? On 2011-05-16, at 8:59 AM, Joel Dart wrote: Hey fernando, I read that part as well, but I think those are more specific cases than the one I'm dealing with. Take the following example (I defined the width of the containing block for clarity): div id=container div id=test/div /div /*css

RE: [JSMentors] Re: getComputedStyle and marginLeft when auto

2011-05-16 Thread Joel Dart
Hey Sheldon, It does return 20px, also, I assumed it was a webkit issue since it failed on Chrome, but Safari actually does produce the correct value. I've reported the bug to Firefox, Chrome, and Opera. -- To view archived discussions from the original JSMentors Mailman list:

RE: RE: [JSMentors] Re: getComputedStyle and marginLeft when auto

2011-05-15 Thread Joel Dart
According to the CSS 2.1 spec, a computed value of 'auto' for 'margin-left'http://www.w3.org/TR/CSS21/box.html#propdef-margin-left or 'margin-right'http://www.w3.org/TR/CSS21/box.html#propdef-margin-right becomes a used value of '0':

RE: [JSMentors] getComputedStyle and marginLeft when auto

2011-05-12 Thread Joel Dart
Joel, that wouldn't stop me from developing in Javascript ;-) Haha, no way! I can always just switch to solely node ;-] I understand this is not the right answer to your question, it wasn't easy either guessing why these differences still exists in 2011 browsers. Yeah, offsetLeft works for

RE: [JSMentors] Re: getComputedStyle and marginLeft when auto

2011-05-12 Thread Joel Dart
The problem is not with the rendering in those browsers. The problem is that the return value of window.getComputedStyle(test, null).getPropertyValue(margin-left) is 0px which is clearly not the used value for margin-left. Also, to be clear, I wasn't looking for a workaround for this issue

RE: [JSMentors] Re: Knockout.js and JavascriptMVC (Jupiter) and functional javascript

2011-05-05 Thread Joel Dart
Yeah, the MVVM pattern definitely goes against traditional web SOC in favor of a more pragmatic separation of business and interface logic, ie what JavaScript runs my app vs what JavaScript runs my dom. This is especially useful when generating multiple items from a template and having the

RE: [JSMentors] Strange bug... jQuery click() event doesn't fire for certain links

2011-02-18 Thread Joel Dart
To get around it, I've added the following to run on every page of the site: jQuery('a').click(function(){document.location.href=this.href}); I don't like this very much - it feels a little dangerous for reasons I can't put my finger on. The reason your gut is saying this is a dangerous is

RE: [JSMentors] Module pattern and testability

2011-02-17 Thread Joel Dart
Also be sure to read this thread from earlier where Christian Johansen weighs in on this directly: http://groups.google.com/group/jsmentors/browse_thread/thread/da28fe220dea609/fd44ec9cf4223e03?hl=enlnk=gstq=testing#fd44ec9cf4223e03 From: jsmentors@googlegroups.com

RE: [JSMentors] $('body') vs $(document) in Pub/Sub pattern

2011-02-03 Thread Joel Dart
1. Body will bubble up through HTML to document. document doesn't have any place to bubble. 2. You don't have to use the dom when doing jQuery custom events. $(document).trigger works the same way as $(myNS).trigger where myNS is your global namespaced object This probably makes more sense

RE: [JSMentors] Re: When we'll have a good IDE for JavaScript?

2011-01-28 Thread Joel Dart
For me personally, I can't code without code folding. But that's nowadays part of most text editors as well, one way or the other. Visual studio otoh has an epic fail in this regard. If you have VS2010, you can actually get code folding as part of the JScript Editor Extensions:

RE: [JSMentors] When we'll have a good IDE for JavaScript?

2011-01-27 Thread Joel Dart
Since you mentioned it, Visual Studio 2010 will autocomplete cross files provided you reference the file at the very top. You can drag and drop the file from your solution, but you'll have to include /all/ your dependencies and be the very first comments at the top of the file (before

RE: [JSMentors] using new with Wrappers

2011-01-13 Thread Joel Dart
I really didn't expect any output. It was doing fine until I used new. Without new it returns a number object. But when I tried to use new and logged it on the console, there I saw this output. Couldn't understand whether its a number or its an object. *Plug for JavaScript Patterns by Stoyan

RE: [JSMentors] using new with Wrappers

2011-01-13 Thread Joel Dart
Why? Well, simply because that's how the specification says it should be. I'm taking a guess here, trying to justify this and would appreciate feedback in my thinking. Since new has to set up the prototype chain, it would necessarily have to return an object since primitives do not have

RE: [JSMentors] Image polling through Javascript

2010-12-20 Thread Joel Dart
You also probably have a helper method in your base library, for example in jQuery, jQuery.now() wraps (new Date()).getTime() -Original Message- From: jsmentors@googlegroups.com [mailto:jsment...@googlegroups.com] On Behalf Of Ben Barber Sent: Monday, December 20, 2010 12:23 PM To:

RE: [JSMentors] What's the best way to implement Object Inheritance?

2010-12-17 Thread Joel Dart
Since you have returned a new object rather than using `this`, an instance of your `Circle` won't respond to `instanceof Circle`. Concerning instanceof on custom objects, what scenarios do you find it necessary vs duck typing(http://en.wikipedia.org/wiki/Duck_typing)? I can see the advantage

RE: [JSMentors] Best practices for using Javascript

2010-12-16 Thread Joel Dart
Concerning the 1 file vs many files, one common approach is to combine your files on production but develop the files separately. You can use Squishit (http://www.codethinked.com/post/2010/05/26/SquishIt-The-Friendly-ASPNET-JavaScript-and-CSS-Squisher.aspx) for an asp.net site and it will even