Huh, I did not know that
TweetThere have been a few web development facts I’ve read recently that have made me say ‘Huh!’, I thought I’d share them with you.
I’m going to add to this list as I find new ones:
- Mobile Safari labels don’t work
- CSS: Text-shadow
- CSS: IE and !important
- Javascript: Get current date
- Javascript: Loop efficiency
- $(window).bind(‘click’) and IE7 and 8 NEW!
Mobile
Form labels in Mobile Safari do not select their input. You can read about the problem and solution at The Watchmaker Project:
How to fix the broken iPad form label click issue
CSS
You can add multiple text-shadow values:
The text shadow CSS property is used to add shading to any text related HTML element. The syntax includes figures for the X-offset, the Y-offset, the blur amount and finally the colour of the actual shadow. What’s more, you don’t have to settle with one shadow, you can build up multiple text-shadow values to create some really cool effects!
You can use a different word in place of !important in IE6 and 7:
In IE6 and IE7, if you use a different word in place of !important (like !hotdog), the CSS rule will still be given extra weight, while other browsers will ignore it.
Javascript
Firefox has its own javascript function to get the current date, which is Date.now(). Obviously this doesn’t work elsewhere so you should use new Date() instead.
Date.now()
This method is listed in the firefox documentation without details. It is not supported by other browsers.
Loops that count downwards are faster than those counting upwards:
We are not worried about the order the images are preloaded so we are loading them from last to first. Loops that count down are faster than loops that count up.
In IE7 and 9 binding a click event to $(window) doesn’t work
You’ll have to bind it to $(document) instead.
No comments.
Add your comment