Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Javascript
Qooxdoo Reaches a Milestone! (1.0)
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="David Mark, post: 4995800"] /* --------------------------------------------------------------------------- DOCUMENT ACCESS --------------------------------------------------------------------------- */ /** * Returns the owner document of the given node * * @param node {Node|Document|Window} the node which should be tested * @return {Document|null} The document of the given DOM node */ getDocument : function(node) { return node.nodeType === this.DOCUMENT ? node : // is document already node.ownerDocument || // is DOM node node.document; // is window }, Worthless, "overloaded" nonsense. Takes elements, documents or windows. What would be the point of passing a document? But it's far better than the one that gets a window:- /** * Returns the DOM2 <code>defaultView</code> (window). * * @signature function(node) * @param node {Node|Document|Window} node to inspect * @return {Window} the <code>defaultView</code> of the given node */ getWindow : qx.core.Variant.select("qx.client", { "mshtml" : function(node) { // is a window already if (node.nodeType == null) { return node; } How can they beat this stuff out of keyboard without stopping to think how stupid the underlying ideas are? And how do they figure they won't have to come back and rewrite all of this crap as soon as browsers change their respective tunes? From the comments, it's clear nobody's home. // jump to document if (node.nodeType !== this.DOCUMENT) { node = node.ownerDocument; } Ludicrous. If they want to know if that property exists... // jump to window return node.parentWindow; This assumes that anything their browser sniffing identifies as IE will support this property. }, "default" : function(node) { // is a window already if (node.nodeType == null) { return node; } So nice, they wrote it twice. :) // jump to document if (node.nodeType !== this.DOCUMENT) { node = node.ownerDocument; } And that. // jump to window return node.defaultView; That may not be a window object at all, but that's a relatively advanced topic. They'll never get there. ;) } }), It makes me wonder if every contributor to an open source JS project reads the same Browser Scripting for Morons book. How else to explain all of these similarly awful projects, all making the same bonehead mistakes? The clipboard? You'd think they could copy something _recent_. :) And there are still developers out there that swear - to this day - that browser sniffing and other bizarre hacks are the only way to write a framework. Similarly, they dismiss mountains of evidence to the contrary as "academic" and endless examples of their incompetence as "growing pains" (never mind that they are ten years behind). I guess a lot of people see this stuff as impossible, despite the fact that it's never been easier. Hanging (and hiding) behind the various library "efforts" is a very hard way to go that is going to approach impossible in the near future (jQuery is already there). [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Javascript
Qooxdoo Reaches a Milestone! (1.0)
Top