[whatwg] Desired Features for Web Applications

Anne van Kesteren fora at annevankesteren.nl
Wed Apr 20 11:25:42 PDT 2005


Brad Neuberg wrote:
> * 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.

<http://www.w3.org/TR/DOM-Level-3-XPath/>


> * 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.

<http://whatwg.org/specs/web-apps/current-work/#getelementsbyclass0>


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

<http://whatwg.org/specs/web-apps/current-work/#serialization>


> * 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")

This would be useful.


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

There are hacks for this.


-- 
  Anne van Kesteren
  <http://annevankesteren.nl/>




More information about the whatwg mailing list