zithromax online
 

data() vs attr() – pick the right method!

Background jQuery introduced jQuery.data() back in 2008 as a way to store data inside an associate JavaScript object. A couple of years later, HTML5 became popular and it introduced a way to write custom attributes using the data- prefix. These custom data attributes can be accessed via the native .dataset object. However, this is a little different than jQuery’s original idea of an internal data object. Custom attributes involve values being associated with HTML elements in the markup and not DOM elements in memory. On the other hand, jQuery.data() would not update attributes in the markup that happen to have the same [ ... ]

HTML5 – Parsing URLs in JavaScript without using regex

Quite a while ago, I was asked an interview question: how do you write a function that is capable of parsing URLs such as “https://www.google.com:1234/index.php?mode=searchUser#name=user1&id=135″ so that you get back the protocol, host name, port number, and the hash keys and values? I used regex, and it was an epically long function that I wasn’t confident that it was going to work. I am not going to show you what I wrote at that time, ever. I am excited to say that with HTML5, it becomes a piece of cake. The anchor element has received tons of new properties that are super [ ... ]

IE bugs caused by CSS filter property fixed in jQuery 1.7

I assume that everyone knows about IE’s ‘filter‘ CSS property. We use it on IE< =8 mainly because they don’t support the W3C opacity property. The new jQuery 1.7 finally added a fix to an issue with IE’s ‘filter’ property. If you look at jQuery 1.7′s source code, you see that it does style.removeAttribute( “filter” ) when opacity is 1 upon setting the opacity csshook. The jQuery upgrade eliminates the need for us to do something like this: 1234j_obj.animate({opacity: 1}, 500, function() { $(this)[0].style.removeAttribute('filter'); // remove filter property at the end of animation... no longer needed in jQuery 1.7 and [ ... ]

Integrating Canvas into your Web App

My tutorial on HTML5 canvas has finally been posted to html5rocks!

Upgrading jQuery – from 1.4.x to 1.6.x

The jQuery library, specifically its architecture of Ajax handling, has been significantly re-written in 1.5. We at Box love jQuery, but we had to skip version 1.5 because a quick jquery.js file replacement failed many of our automated test cases. After a couple of weeks of debugging, we finally migrated to version 1.6.1. In this post, I want to share my experience upgrading jQuery from 1.4.4 to 1.6.1. prop() and attr() prop() is a new method to retrieve a property value of a DOM object, while attr() is used to retrieve attribute values written in the HTML source. attr() used [ ... ]

Popup blocker detection pattern

Have you ever wondered why popup blockers hate certain popup windows, but not others? The underneath formula is pretty simple: if a window.open() call is not on top of a click event in the call stack, popup blockers would block it unless it’s on the exception list. This can be verified using Firebug or Chrome Developer Tools. Call stack of window.open() triggered indirectly from a click event Call stack of window.open() triggered from an Ajax callback Therefore, the rule of thumb is that you should avoid calling window.open() from anything other than an user-initiated click event. What if it’s a [ ... ]

Switching between box models 2011

Do we all hate IE because the IE box model makes more sense? For those who don’t know and are lazy to look it up, prior to IE 6, IE used to include border and padding in its calculation of the width (and height) of a page element. This is different than the “standard” W3C box model, which defines width as only the width of the content, not including padding and border.

z-index misconceptions, IE bugs and fixes

Update (12/1/2011): Version 1.2 In the past 13 years, I have worked on numerous issues related to layering, specifically the z-index CSS property. It is one of the most misunderstood CSS properties. Surprisingly, there are not many well-written articles or tutorials on this topic. I came across this blog post that talks about the way to fix a z-index issue. It works as it nails the key point about the parent element, but there isn’t much explanation. You can find all the misconceptions written by other readers. To understand what z-index is, I find this to be the best beginner’s post. This post [ ... ]

Code Standards & Best Practices

This is the code standards doc that my previous team at Isobar/ Molecular created in early 2010. It was wildly circulated since its release. The doc contains a lot of knowledge that we have gathered in our combined 100+ years of web experience. You may find it useful if you are curious what best practices that third-party agencies are following. http://na.isobar.com/standards/

IE8 Developer Tools won’t open

This may sound stupid, but I ran into this issue that upon pressing F12 or choosing Tools > Developer Tools, the IE Developer Tools window does not show up. It is, however, showing up in the task bar. The issue is that when you have Developer Tools detached from the browser window, and you don’t close it before exiting the browser, the next time you open IE8 and try to run Developer Tools, the Developer Tools window will be an ‘invisible state’ (simply put…). The solution is to right-click on the tab/ icon in your Windows task bar and choose Maximize. If [ ... ]