4 ms·
I mean no offense to the author, but speaking of the DOM as if it is uniform in terms of performance seems silly. Pretty much every piece of API in the DOM has
by kellegous 13y ago
I mean no offense to the author, but speaking of the DOM as if it is uniform in terms of performance seems silly. Pretty much every piece of API in the DOM has its own semantics and performance expectations (even if it's presented as a JavaScript property). Reading Element.offsetLeft, for instance, is a whole different world from reading Node.nodeType.
Just looking at their implementations in WebKit should tell you why:
https://github.com/WebKit/webkit/blob/master/Source/WebCore/dom/Element.cpp#L638 https://github.com/WebKit/webkit/blob/master/Source/WebCore/...
https://github.com/WebKit/webkit/blob/master/Source/WebCore/dom/Element.cpp#L327 https://github.com/WebKit/webkit/blob/master/Source/WebCore/...
- esailija 13y agoAlso, the code doesn't call into DOM directly but uses jQuery .html() for "reading" and .html(Math.random()) for "writing". The case is extremely misrepresented indeed.
- AsymetricCom 13y agoThe DOM is a failed institution trying to grab on the the ledge before it falls into the abyss. W3C should be disbanded and HTML5 abandoned. JavaScript and it's ilk should be boycotted by users as well. This kind of complexity should exist on the server, not in the browser. I understand that people want to run complex apps in the browser. It's a bad idea in general but where it's needed, it should be PLATFORM DEPENDENT, implementing the tools that keep that platform safe. ie iOS, Windows, whatever. We are still in the browser wars, why are we so keen to adopt standards that aren't standard? DOM Lvl 4 even features GC! Can we not see why this is a bad idea?!? Keyboard bindings also do not belong in a "standard". I wish this would get more attention by serious developers, but I think that most people who know better wouldn't care and aren't interested in understanding and digging into a lame standard. It's a land grab, only enterprises can and will ever be able to implement it correctly and completely, as the standard spreads to consume more of the user's space. Here are some people who agree with me: http://www.adamcrume.com/blog/archive/2009/12/23/the-java-dom-api-sucks http://www.adamcrume.com/blog/archive/2009/12/23/the-java-do... http://programmers.stackexchange.com/questions/147451/whats-so-bad-about-the-dom http://programmers.stackexchange.com/questions/147451/whats-...
- rquantz 13y agoI'm trying to figure out if you're being sarcastic.
- AsymetricCom 13y agoYou have fun with that, and the DOM. I'm oute
- thezilch 13y agoWTF is this? I don't even know where to begin with this crackpot of a post. You suggested nothing of value and just spout a bunch of FUD. To your friends that agree with you from 2009, use `querySelectorAll` for a non-live NodeList, assuming he has kept up with JS actually having evolved and converging on standards. I bet you flip your lid, too, to learn your server-side-only dystopia is running on top of JS (Node) services.
- AsymetricCom 13y agoI covered JS... You have nowhere to begin because I'm absolutely right. The DOM is klausterfokken.
- deleted 13y ago[deleted]
- gruseom 13y agoCan you please not be so abrasive on HN? Your points may be correct, but your tone is exactly what we're trying hard to avoid here.
- GalacticDomin8r 13y agoAh the white knight. Please please I beg you be nice.
- fuckjavascript 13y agoYes and no. The choices are: (a) build a dumb terminal, or (b) build a platform for distributed applications. Currently, we have a dumb terminal with some programming features bolted onto the side. All kinds of concerns are mixed together. For example, portability and security of code execution are must be maintained by the Javascript implementation, whereas the only sensible way to do this is to use the VMM to sandbox code, then use a non-security-critical portability layer that can optimize some portable code as aggressively and unsafely as you like (not sure if this is what you're alluding to with your platform-dependent remark). Sans the VMM part, which I only thought of a few years ago, I told people all of this (that once you commit to programming on the web you need a REAL programming platform) years ago, and was dismissed. Now that it's been half-done with asm.js, webgl, websockets etc being jammed in alongside all the dumb terminal concepts as well as all the horrible previous attempts to mix programming in (e.g. Javascript and the DOM), we're unlikely to get all the way there, because it will be "good enough".