Telerik blogs

In the past, web development was difficult due to the different ways browsers handled rendering CSS as well as JavaScript.  Client side code was riddled with if then else statements, and even then, developers and  QA engineers spent way too much time testing the different browsers and versions.

Windows 8 Store applications have the benefit of only running in IE10 based technology. This means that applications only have to be tested in Windows 8, but it also means that developers can use IE10 quirks to their advantage.

My favorite “quirk” in IE10 is the ability to reference HTML elements by their id attribute as if the id was a global variable.  So instead of referencing DOM elements by calling document.getElementById(‘contactdetail’), you can reference them directly by just using the id.  This is shown in Listing 1.

//Old browser safe way to refernce DOM element 
var editContactCommand = document.getElementById('editContact');
editContactCommand.disabled = true;
 
//New way taking advantage of IE10 id quirk 
editContact.disabled = true;
Listing 1

Japikse
About the Author

Phil Japikse

is an international speaker, a Microsoft MVP, ASPInsider, INETA Community Champion, MCSD, CSM/ CSP, and a passionate member of the developer community. Phil has been working with .Net since the first betas, developing software for over 20 years, and heavily involved in the agile community since 2005. Phil also hosts the Hallway Conversations podcast (www.hallwayconversations.com) and serves as the Lead Director for the Cincinnati .Net User’s Group (http://www.cinnug.org). You can follow Phil on twitter via www.twitter.com/skimedic, or read his personal blog at www.skimedic.com/blog.

 

Comments

Comments are disabled in preview mode.