Posts

Showing posts with the label safari

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 :)

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...

Safari 4 Multiple Upload With Progress Bar

Update - I slightly modified the demo page adding another bar, the one for the current file. I'll update the zip asap but all you need is a copy and paste of the JS in the index. Apparently multiple should be set as multiple, rather than true ... in any ... it works as long as it is an attribute. This one from Ajaxian has been one of the best news I could read about HTML5 specs and browsers evolution. I could not wait to download Safari 4 and test instantly this feature. I have always been interested in this possibility, both progress bar, plus multiple uploads and that's why I would like to add this post to this list: PHP upload progress , 22 September 2005 FileReference for JavaScript , 08 November 2005 Upload progress bar with PHP5, APC and jQuery , 09 October 2007 First Step: The Input Type File We can create a multiple input files in different ways: directly in the layout <input type="file" multiple="multiple" /> or via JavaScript:...

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...

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....