Non Gamstop CasinosNon Gamstop CasinosNouveau Casino En LigneCasino En Ligne FiableMeilleur Casino En Ligne

Posts Tagged ‘javascript’

JavaScript on iPhone 2.0

Thursday, August 7th, 2008

I got bored the other day and ran the SunSpider JavaScript benchmark in Safari on my iPhone 3G running the 2.0.1 OS release, with no other tabs open. Here are the results.

But the punch line is that Safari 3.1 running on my MacBook Pro is 45 times faster at JavaScript than Safari 3.1.1 running on the iPhone.

(Safari on the iPhone is still really impressive, of course.)

Comments

How to Generate a String for DOM Nodes in JavaScript

Monday, July 14th, 2008

Since I just struggled with this for a couple of hours, I figured I’d post it here for posterity.

If you want to generate the string representation of some XML in JavaScript, here’s how to do it (using the Prototype 1.6 syntax for element creation), courtesy of Captain’s Universe:

var contactsElement = new Element("contacts");
   
  var evanElement = new Element("contact");
  Element.insert(evanElement, new Element("name").update("Evan Series"));
  Element.insert(evanElement, new Element("blog", {'type': 'personal'}).update("http://www.evanseries.org"));
  Element.insert(evanElement, new Element("email", {'type': 'school'}).update('[email protected]'))
  Element.insert(contactsElement, evanElement);
   
  var zachElement = new Element("contact");
  Element.insert(zachElement, new Element("name").update("Zach Paine"));
  Element.insert(zachElement, new Element("blog", {'type': 'personal'}).update("http://zachpaine.info"));
  Element.insert(contactsElement, zachElement);
   
  alert(new XMLSerializer().serializeToString(contactsElement));

I don’t know if this works with IE yet; I’ll update this post when I find out.

Comments

Community picks