If we hit that bullseye, the rest of the dominoes should fall like a house of cards. Checkmate.
The problem caused by scripts is that they block parallel downloads. The HTTP/1.1 specification suggests that browsers download no more than two components in parallel per hostname. If you serve your images from multiple hostnames, you can get more than two downloads to occur in parallel. While a script is downloading, however, the browser won't start any other downloads, even on different hostnames.
Including External Scripts ⚑
Expires
and Cache-Control: max-age
headerfs
age
, firstName
createNewMemberIfAgeOverEighteenAndMoonIsFull
x
and y
isLegalAge(18, age)
than isOverEighteen()
as it gives your more wiggle roomborder
of 1px solid red
and change the color
to red
and make the text bold
and set the background
to something red
-ish if you can just add the class .error
to an element?0px
→ 0
, #FFFFFF
→ #FFF
, etc.CNAME
records to your domain to have your server serve more parallel requests.extend
⚑var myList = $('#myList');
for (var i = 0; i < 1000; i++){
myList.append('<li>This is list item ' + i + '</li>');
}
var myList = $('#myList');
var myListItems = '';
for (var i = 0; i < 1000; i++) {
myListItems += '<li>This is list item ' + i + '</li>';
}
myList.html(myListItems);
var items = $('li');
items.css('background-color','red').css('color','lime').css('border','1px solid blue');
var items = $('li');
items.css({
'background-color': 'red',
'color': 'lime',
'border': '1px solid blue'
});
radix
when using parseInt
$.fn.on()
with extra selector string to filter the descendants of the selected elements that trigger the event
$('table').on('click', 'td', function(e) { ... });
$.fn.live()
$.fn.delegate()
is possible, but we prefer the variant of $.fn.on()
#id
, element
.class
Document#getElementsByClassName
in IE5-8!:visible
) & attribute ([title="foo"]
)
.find()
.find()
requestAnimationFrame()
instead of setTimeout()
$('a').on('click', function(e) {
alert($(this).attr('href'));
});
$('a').on('click', function(e) {
alert(this.href);
});
document.querySelectorAll('a').addEventListener('click', function(e) {
alert(this.href);
});