As part of a recent project, I had to implement a Knockout table component that could sort and filter its entries in realtime. This would normally have been straightforward, except for a handful of use-cases where the table would contain upwards of three thousand entries – possibly more. Calling a native array sort() on such a large set with a particularly complex comparator would force IE8 to freeze for several seconds and throw a long running script error.
It’s not complicated, but it if you’ve never taken the time to read its specification, there are almost certainly crucial aspects that you’re completely unaware of. Don’t believe me? Well, see if you can solve this problem: The Problem In the following HTML you have three <div> elements, and each <div> contains a single <span> element. Here’s what the HTML and basic CSS look like. <div><span class="red">Red</span></div><div><span class="green">Green</span></div><div><span class="blue">Blue</span></div> Here’s the challenge: try to see if you can make the red <span> element stack behind the blue and green <span> elements without breaking any of the following rules: Do not alter the HTML markup in any way.
JS Theory. Events and timing in-depth. Internally, the browsers are event-driven.
Today, we're going to put on our computer science hats as we learn about some common design patterns.
SyntaxEdit Object.create([, ]) Parameters proto The object which should be the prototype of the newly-created object. propertiesObject.