(function(){
...
})();
чтобы не засорять глобальный скоуп ненужными переменными var width = document.documentElement.clientWidth;
var oldViewport = document.querySelector('meta[name="viewport"]');
var viewport = document.createElement('meta');
viewport.setAttribute('name', 'viewport');
viewport.setAttribute('content', 'width=' + (width <= 640 ? '640' : 'device-width'));
document.head.replaceChild(viewport, oldViewport);
но что если я хочу переопределить стиль для последней ссылки?
li:last-child > a:hover { }
Цитата из спецификации w3c:
In the absolute positioning model, a box is explicitly offset with respect to its containing block. It is removed from the normal flow entirely (it has no impact on later siblings).