主要是在記憶體流失上的改進(function() {window.EventUtils = {eventFuncs : [],addEvent : function(o, n, f) {var el, id;// Resolve element by id if neededo = typeof(o) == 'string' ? document.getElementById(o) : o;if (o.attachEvent) {// Since we can't use
multimedia accessibility, Ogg Theora, and the year 2022.Welcome back to "This Week in HTML 5," where I'll try to summarize the major activity in the ongoing standards process in the WHATWG and W3C HTML Working Group.There is no big news this week.
Following up on Antranig’s recent post about performance, I’d like to address the issue of code design and its relationship to performance. Antranig’s article is very comprehensive and well-considered, and it provides us with a number of guidelines
選取器唯數不多的幾個能尋找元素的方法,其他都是過濾元素。一個重要的需求就是從一組元素中獲得tagName等於tag的子集,如過選取器如#id tag的形式,就要求過濾,但如果選取器是tag tag呢?那麼為了效率,就要求每個元素進行tag.getElementsByTagName(tag)操作。我早期的實現,利用uuid技術防止重複: //獲得經過標記的沒有重複的tagName等於tag的元素集 var getElementsByTag = function (tag,
這是實現結構偽類only-of-type的部分代碼: var ret= ["span","span","strong","span","b"] var norepeat = function(array){ var set = array.join(",")+","; while(array.length){ var el = array.shift(); set = set.replace(el+",",""); if(
以前最短的IE判定藉助於IE不支援垂直定位字元的特性搞出來的。var ie = !+"\v1"; 僅僅需要7bytes!參見這篇文章,《32 bytes, ehr ... 9, ehr ... 7!!! to know if your browser is IE》,講述外國人是如何把IE的判定從32 bytes一步步縮簡成7 bytes!的故事但這紀錄今年1月8日被一個俄國人打破了,現在只要6