Elgg/Elgg — comment on commit 518083ff5d13b6bec789bbdac03f4004b457c0ed
File:  line 0
By brettp:

Looked into this more. The DOM isn't as robust as the current solution because it doesn't support user and password. I'm looking into a hybrid approach because there are still some issues with the regex version.

Here's a good discussion on this, as well as some benchmarking:
http://james.padolsey.com/javascript/parsing-urls-with-the-dom/

Basically, regex is more versatile, though less reliable. DOM is slower, but no one will notice.