Wednesday, September 3, 2008

V8, Chrome and the DOM

V8 is the Javascript engine for Chrome, the new Google web browser. It is very fast.

V8 does not provide DOM or XML DOM support. This was confirmed to me by a member of the team at the V8 google group.

This leaves me with a question i hope someone can answer.

Most of the scripts i write either use the DOM (getElementById) or the Xml Dom (childNodes[0].nodeValue) and so on. That is a LARGE part of my scripts.

So if the engine does not provide support for this, what happens to my scripts? Do they go really fast until they need to query the DOM and then slow down? The net effect in my case could be a lot of slowing down. I my experience, querying the DOM is the slowest part of your scripts (unless you write non-typical).

Haven't had time (and won't today) to run tests so if you know the answer please let me know.

2 comments:

mo said...

Well, I have found that loading an xml document in Javascript (that works in FF and IE) doesn't work anymore in a web app when I run it in Chrome.

It was a pain getting the application to run in both IE and FE and I hope it's not the same level of pain to make it work in Chrome.

Been googling for a fix but so far no luck.

mo said...

Got a fix/workaround as described here:

http://ejohn.org/blog/javascript-in-chrome/