Update code from HTML5 spec