Posts

Showing posts with the label firefox

195 Chars To Help Lazy Loading

Update removed named function expression Update I wrote events letters in the wrong place, please use the latest script We have talked many times about performances, and not only here. One common technique to speed up a generic online page is the lazy loading. For lazy loading I mean: runtime dependencies resolution via script injection, preferably including all dependencies we need in a shot rather than script after script Google comments style, where code is evaluated when required but the size is still there namespaced strings, an example I have explained via code in Ajaxian whatever else, because sometimes we need this or that library only in certain conditions What Is The Problem If we would like to widely adopt this lazy load pattern, we should be aware about a " little detail ": Firefox < 3.6 does not support document.readyState , an historically valid Internet Explorer feature adopted in HTML5 and present in basically every other browsers. We can find the readySta...

fireEvent for FireFox, Safari, and others

Just a quick update about vice-versa , I have implemented fireEvent to fire, as the method name says itself, events after attachEvent. Do you prefer the dispatchEvent way with at least 3 different ways to initialize an event usually fired only to call the callback? It is this: a.addEventListener("click", function(evt){ location.href = evt.target.href; evt.preventDefault(); return false; }, false); // powerful uh? now think // when you used something different // from defaults ... var evt = document.createEvent("MouseEvents"); evt.initMouseEvent( "click", true, true, this, 0, 0, 0, 0, 0, false, false, false, false, 0, null ); a.dispatchEvent(evt); against what I think is often all we need: a.attachEvent("onclick", function(){ location.href = event.srcElement.href; return event.returnValue = false; }); a.fireEvent("onclick"); and that's it :)

The Fastest Selector Engine For FireFox 3.0 ?

Image
I am putting some effort to make vice-versa project a good, production ready, alternative against common libraries, and since these days I am working hard with XML, XSL(T), and XPath I decided to try an experiment implementing CSS to XPath translator for FireFox 3.0 With version 3.1 we will have querySelector and querySelectorAll but version 3.0 is still the most used one, FireFox speaking! The nightly build of vice-versa introduces a new file, mainly used for personal experiments via vice-versa library and the first experiment is an improved document.query for those browsers with document.evaluate support without document.querySelectorAll . Unfortunately Internet Explorer SlickSpeed Selector Speed Test comparing latest version of each library such Dojo , DOMAssistant , Sizzle (congrats for the new site!), Sly , and finally vice-versa project. Here the summary, from faster to slower: vice-versa 760ms Dojo 1.3.1 868ms (2 tests failed) DOMAssistant 880ms (good stuff Robert!)...

Multiple Upload With Progress: Every Browser No Flash !!!

Image
Update: released official version in Google Code, cross browser, and easy to use. blog enry Ok guys, this is a quick and dirty entry in my blog. I need to write documentation, create the project in Google Code, explain better what I have done and how it works. I do not want to give you the zip right now because I have to change name (silly me do not check before) and to do last tests ... but basically, what I have created this week end, is a graceful enhanced multiple file upload manager compatible with Chrome, FireFox, Internet Explorer (5.5 or greater), Opera, Safari. The manager wrap an input type file and manages it allowing multiple files selection, where supported, or one after one insert with possibility to remove one or more file from the list. Everything is absolutely customizable, since the wrapper is entirely in CSS, the library has a language namespace for errors or messages, and events are created by developers. In those browsers were Ajax upload is not supported, the pro...

outerHTML for almost every browser ... if you need it ...

We all have to deal with memory leaks problem and apparently a good way to be sure that an HTMLElement has been removed from its "flow" is the outerHTML assignemnt (thanks Ariel for the suggestion) element.outerHTML = ""; element = null; If the element is not a document.body or another body parent node, Internet Explorer will "extract" that element from its context, if any, and if there are no other references for that element the null assignment will, theoretically, complete the opera, hopefully solving memory leaks problem for that node as well ... To remove ... but to replace too ... Every library has a " swap " or replace method to quickly change an element, but even if we all know that innerHTML is the fastest way to insert content, few libraries use outerHTML to replace nodes , that as far as I know, should be " that fast " in IE as innerHTML is: // traditional swap, the DOM way function swap(oldNode, newNode){ var parentNo...

How to crash FireFox 3 with 3 lines of code

Hi there, here I am back from holidays :geek: Before I'll start to write more interesting stuff, here we have 3 lines of JavaScript that could cause problems to our favourite browser, in this case version 3.0.1 I discovered this problem, already part of the bugs report site, trying to emulate keyboards events using the UIEvents interface instead of KeyboardEvents var e = document.createEvent("UIEvents"); e.initUIEvent("keypress", true, true, this, 1); document.documentElement.dispatchEvent(e); Nice one? See you soon ;)

Do You Like Browser Benchmarks? Here I am!

Hi guys, today we will not talk about my last JavaScript ArrayObject creation :D Today is the benchmark day, and in this case the test is as simple as explicative ... both Math object and scope are two things we use every day for whatever purpose in this baby Web 2.0 era! Let me start directly with results (ORDER BY speed ASC): Firefox 3.0b4 ---------------------------------- regular avg time in ms: 9.98 scoped avg time in ms: 3.18 encapsulated avg time in ms: 12.98 Safari 3.0.4 (523.15) ---------------------------------- regular avg time in ms: 13.42 scoped avg time in ms: 6.42 encapsulated avg time in ms: 11.82 Opera 9.24 ---------------------------------- regular avg time in ms: 13.82 scoped avg time in ms: 9.6 encapsulated avg time in ms: 17.64 Internet Explorer 8.0.6001.17184 ---------------------------------- regular avg time in ms: 16.42 scoped avg time in ms: 6.82 encapsulated avg time in ms: 16.82 Firefox 2.0.0.12 ---------------------------------- regular avg time in ms: 26....