Leveraging Browser Quirks in WinJS

.NET Musings

Wandering thoughts of a developer, architect, speaker, and trainer

NAVIGATION - SEARCH

Leveraging Browser Quirks in WinJS

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

About the author

Philip Japikse

2012STLDODN.93x112 Philip Japikse an international speaker, a Microsoft MVP, INETA Community Champion, MCSD, CSM/ CSP, and a passionate member of the developer community, Phil Japikse 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 works as a Developer Evangelist for Telerik's RadControls for Windows 8 as well as the Just family of products (JustCode, JustMock, JustTrace, and JustDecompile) and co-hosts the Hallway Conversations podcast (www.hallwayconversations.com). Phil is also 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 read his Telerik blog at http://blogs.telerik.com/skimedic and his personal blog at www.skimedic.com/blog.

Comments are closed
Managed Windows Shared Hosting by OrcsWeb