Events – why something.changed instead of something.on(“changed”, ….

Whenever I was using custom events there were:

something.on("changed", function myonchange() {

However, now I start to use better way:

something.changed(function myonchange() {

The benefits of this change are:

  • The list of events can be seen in the debugger.
  • Events can be copied from one object to another.
  • Several events can be aggregated into one.


Read more

Font size in OS and screenshots

I set my font size in OS to 125% to make them little bit bigger. However, when I started make a screenshots then I realized that the size of the box was different than I defined in CSS. So, take a look at this picture:


In developer console I saw that the width is about 600px. However, when I made a screenshot and measured the width in Gimp then I found that the width is… 875px. See picture:


Conclusion: when you make a screenshot make sure your font size in OS is sets to 100% to avoid a problems with checking sizes of the element[……]

Read more

Faster way to delete a large folder in Windows

How to

I wanted to delete a folder that contains thousands of files and folders (I’ve used Windows 2012 Server). If I use Windows Explorer to delete the folder (just in my case) then it takes ~4 minutes 30 seconds (not always, but often). Too long. Unfortunately, Windows Explorer is slow for this as it first scans the whole directory so that it can show the estimate and then copies everything into the recycle bin or not, if the directory is too big. Small tip: you can hold SHIFT key when you click option do delete files and Windows will not[……]

Read more

Word 2010 and temp folder problem

I was experimenting with RAM disk and was changed the localization of temp folder. After all I’ve uninstalled not needed anymore software that was responsible for managing RAM disk and because of that I couldn’t work with Microsoft Word 2010. So, for those who had the same issue with temp folder problem and Microsoft Word 2010 here is the solution:

The error message “Word could not create the work file. Check the temp environment variable”. Can be caused by incorrect registry values in the key:


Read more

Generate dynamically iframe and it’s content

Let’s say you want to generate dynamically iframe and instead of point to external source:

var iframe = document.createElement('iframe'),
    body = document.body || document.getElementsByTagName("body")[0];

iframe.src = "myiframecontent.html";
if (body) {

you want to create dynamically content inside iframe. Sounds crazy, but… it’s possible. Partially. We can use data URI with content encoded using base64. By the way, you can use base64 encoding/decoding online t[……]

Read more

Google Chrome and load insecure content

Google Chrome, by default, blocks insecure content on secure pages. It doesn’t allow you to mix HTTPS and HTTP connections. In developer console you’ll see:


However, you can allow Chrome to load insecure content. When you visit a secure page with insecure content, a shield icon will appear at the right edge of the omnibar.


Click on the shield icon, and then click Load unsafe script, and the insecure content will be loaded.[……]

Read more

JavaScript fast reverse table rows

So, you want to fast revers rows in table. There is probably millions of possible solutions, but here I’ll preset my approach. Here is the code:

function reverseTableRows(tableId) {
    var table = document.getElementById(tableId),
        newTbody = document.createElement('tbody'),
        oldTbody = table.tBodies[0],
        rows = oldTbody.rows,
        i = rows.length - 1;

    while (i >= 0) {
        i -= 1;
    oldTbody.parentNode.replaceChild(newTbody, oldTbody);

tableId pa[……]

Read more

JavaScript, generate accessible table of content (TOC)

I’ve created simple and accessible script for generating table of content based on HTML header elements. Try example. The source code you can find on GitHub.

The goal was to written short as much as possible code with taking care about accessibility. I’ve tested solution with JAWS 14 / Windows 7.[……]

Read more

The direction of embedded text and how to verify what’s contains string

When you are working on internationalization of HTML inline element then you can use dir attribute or you may use special Unicode characters to achieve multiple embedded direction changes. However, sometimes there could be a bugs in your translated strings and when you use Unicode characters then debugging is little bit tricky. You may think that maybe your code is somewhere broken.

To illustrate the problem let’s say you have a string that is encoded in ar-SA (Arabic (Saudi Arabia)) language, but for some unknown reason one of character (pa[……]

Read more

contenteditable and prevent from going to new line using ENTER key

Let’s say we have a simple div HTML element with attribute contenteditable. Sometimes we want to observe ENTER key and prevent cursor to go to new line when user hit ENTER key without SHIFT key. To do this you can use event onkeyup. See example how it works.

And? Yeah, the cursor is going to new line when you hit ENTER key. It’s relatively quick, but it’s still visible behavior. This is not exactly what we expecting. We do not what to move cursor to new line when user hit ENTER key without SHIFT key. Ok, why this happen?

It happens becau[……]

Read more