[whatwg] Desired Features for Web Applications

Brad Neuberg bkn3 at columbia.edu
Wed Apr 20 11:10:48 PDT 2005


As someone who works with web application development, here's some of the 
things that would make my life easier.  Also, including certain methods as 
part of the standard that I usually have to roll on my own would make 
things more standardized:

* Have a document.getByPath() method that takes an XPath expression to 
traverse and find any nodes in the document; this would be _extremely_ 
powerful and would erase a huge amount of boilerplate code needed for 
walking over the DOM using the standard DOM traversal methods.  This would 
have to be a fast implementation though or else it couldn't be depended on.

* Have methods for traversing the DOM based on the 'class' attribute.  If 
you have XPath type traversal this is somewhat less needed, but I find 
myself rolling methods in most projects to work with my document by class 
name.  Example methods I have rolled for myself along these lines:
         * xGetElementsByClassName(rootElement, className, tagName) - Gets 
all the elements rooted at rootElement with the given className, optionally 
restricted by tagName
         * xGetSingleElementByClassName(rootElement, className, tagName) - 
Same as the above, but just returns one element
         * xGetParentElementByClassName(rootElement, className, tagName) - 
Navigates upwards until we hit a parent element with the given class name 
and optional tag name.

* Formalization of innerHTML as being a standard part of creating web 
applications

* Right now most people directly access an elements className property, 
without realizing that they might be clobbering multi-classed elements 
(i.e. something with class="class1 class2").  I usually have to create 
wrapper methods to ensure that this doesn't happen, such as 
xAddClass(target, className), xRemoveClass(target, className), and 
xHasClass(target, className), but it would be much nicer if the className 
property itself had better support for multi-classed elements.  Some 
example possibilities of what this might look like:
         * someElement.className.add("someNewClass")
         * someElement.className.remove("SomeOldClass")
         * someElement.className.hasClass("someClass")

* The lack of min-width and max-width in IE's CSS makes things difficult.

Brad


Brad Neuberg, bkn3 at columbia.edu
Senior Software Engineer, Rojo Networks
Weblog: http://www.codinginparadise.org

=====================================================================

Check out Rojo, an RSS and Atom news aggregator that I work on.  Visit 
http://rojo.com for more info. Feel free to ask me for an invite!

Rojo is Hiring!  If you're interested in RSS, Weblogs, Social Networking, 
Java, Open Source, etc... then come work with us at Rojo.  If you recommend 
someone and we hire them you'll get a free iPod!  See 
http://www.rojonetworks.com/JobsAtRojo.html. 




More information about the whatwg mailing list