Frontend Conference 2013
Urban Etter
['hello', 'world'].join(' ')
instead of
'hello' + ' ' + 'world'
... that slowing down the search results page by 100 to 400 milliseconds has a measurable impact on the number of searches per user of -0.2% to -0.6%
by Google
To get that sensation, your requests need to take less than 100ms.
by 37 signals
for older browsers
<head>
<link rel="stylesheet" href="style.css">
<script src="script.js"> </script>
</head>
<body>
My fancy content
</body>
async
attribute
<head>
<link rel="stylesheet" href="style.css">
<script src="script.js" async></script>
</head>
<body>
My fancy content
</body>
async
== not blockingPreferred
<head>
<link rel="stylesheet" href="style.css">
</head>
<body>
My fancy content
<script src="script.js"></script>
</body>
<img src="img/placeholder.png"
data-original-src="img/real_image.jpg">
.sprite-musikwelle {background-position: 0 0; width: 46px; height: 22px;}
.sprite-srf1 {background-position: -66px 0; width: 46px; height: 22px;}
.sprite-srf2 {background-position: -132px 0; width: 46px; height: 22px;}
.sprite-srf3 {background-position: -198px 0; width: 46px; height: 22px;}
.sprite-srf4 {background-position: -264px 0; width: 46px; height: 22px;}
.sprite-virus {background-position: -330px 0; width: 46px; height: 22px;}
<script src="script.js"></script>
<script src="script.js?v=12"></script>
<head>
<link rel="stylesheet" href="style.css">
</head>
<body>
My fancy content
{render_include('global')}
</body>
[global]
javascript[]=jquery.js
javascript[]=jquery.cookie.js
...
function render_include(groupName) {
files = getFilesByGroup(groupName);
if (files.newest > lastRun.timestamp) {
result = pack(concatenate(files));
filename = md5(files.newest);
save_file(filename, result);
} else {
filename = lastRun.filename; }
return '<script src="filename">'; }
$('#msg').addClass('very_important');
<select id="topic">
<option value="topic:news">
News
</option>
<option value="topic:twitter-relevant">
Twitter relevant
</option>
</select>
<div class="letter" data-letter="t">
<ul>
<li data-attr="topic:news,station:srf1">
Tagesschau</li>
</ul><ul>
<li data-attr="topic:twitter-relevant">
Tatort</li>
</ul>
</div>
var topic = $('#topic-filter').val();
var station = $('#station-filter').val();
var selector =
'[data-attr*="' + topic + '"]'
+ '[data-attr*="' + station + '"]';
$('li').show(); // reset
$('li:not(' + selector + ')').hide();
$('div.letter').each(function(){
$('li.show')
.hide()
.find(selector)
.clone()
.addClass('copied')
.appendTo('body');
... });
...
$('li.copied).each(function(){
// append to left or right ul
$(this).show();
});
...
$repository = $('li.show').hide();
$('div.letter').each(function(){
$repository
.find(selector)
.clone()
.each(function(){
// append to left or right ul
})
.show(); });