JavaScript

Why does JavaScript even have null?

JavaScript has its quirks and difficulties. One of them is null & undefined. If there’s undefined, why does JavaScript even have null? Equality Let’s start exploring null and undefined by having a look at the following comparisons: null >= 0; //true null <= 0; //true null == 0; //false null > 0; //false null < 0; //false How can null be bigger or equal to zero, less or equal to zero, but not be equal to zero?! To understand this we have to know how JavaScript handles these comparisons. There are two different kinds of operators used in the example above: Equality Operators …

HTML5, JavaScript

Keep your password safe!

I’m currently working on a short course on web security. In this course, I’m going to show a couple of common mistakes in websites that create gaping holes. I’d like to give you a small tip in advance, just to make you more aware of what you are doing when you hit that ‘remember my password’ button in your browser. Although I’m pretty sure your browser itself keeps the password safe, it has to place it in the password field of the login form to be able to submit it. With this small trick you, (and anyone else that might…

JavaScript

Progressive Enhancement

Since last December I’ve been giving talks about Progressive Web apps. A couple of them where lightning talks of 10 minutes. One of the things I had to remove to fit the slides and the demo into those 10 minutes was the explanation of Progressive Enhancement, although it’s in the definition of a PWA. So, let me explain…

JavaScript, WinJs

Quick note on WinJS templates and controls

Today I was working streaming (https://livecoding.tv/sorskoot) building my new JavaScript Audio Workstation. I wanted to use a template in a custom WinJS control but found it wasn’t in the samples.  Also, the MSDN documentation contained an error which made it even harder to get it to work.

Angular, Cordova, JavaScript, Visual Studio

Debugging AngularJS in Visual Studio 2015

While working on the Cordova Drum Machine I’m currently streaming live at LiveCoding.tv/sorskoot, I ran into a few issues with Visual Studio debugger. Normally I debug my ‘normal’ AngularJS web applications inside Chrome using an extension on the debug tools that shows the context of the selected HTML element. In Visual Studio I do not have these tools available. Here’s how to get information on the Angular context of a selected element. Scope The first thing that’s really useful to gain insight to is the Angular scope. The scope has to be read from a specific DOM element. To select…

JavaScript

Poor Mans jQuery

A lot of people use jQuery in their HTML/JavaScript applications. There’s nothing wrong with that. But I’ve seen a lot of people use jQuery only to make it easy to find elements and they are not using any of the other jQuery functions. It’s pretty clear that writing a single ‘ $ ‘ instead of the way longer usages of various function on the ‘document‘ object, like getElementById. One of the functions on the ‘document’ object is the querySelectorAll function. This function brings a similar experience to vanilla JavaScript by taking selectors as a parameter.  So if we take a…