[dojo-contributors] DOM NodeType values not in 0.9

Tom Trenka ttrenka at gmail.com
Fri Jun 8 16:22:52 EDT 2007


I don't disagree with what Brad is asking for but at the same time, I'm kind
of with Adam.  It's the same with all of the XMLNS's I'd originally defined
in dojo.dom as well; nice to have but can be cut in the name of bloat.
I actually just stick versions of these definitions locally within whatever
code might use them (right now, that's just the custom XML parser in DojoX
XML.)

trt

On 6/8/07, Adam L. Peller <adam at peller.org> wrote:
>
> I don't see this as necessary and size counts -- it increases the size
> of the expression from one byte to twenty one.  I might even prefer
> "1".  You don't see the others very often, especially beyond "4".
>
> -Adam
>
> On 6/8/07, Brad Neuberg <paperairplane at gmail.com> wrote:
> > I jost noticed that the old dojo.dom NODE_TYPE definition stuff is no
> > longer in 0.9:
> >
> > dojo.dom.ELEMENT_NODE                  = 1;
> > dojo.dom.ATTRIBUTE_NODE                = 2;
> > dojo.dom.TEXT_NODE                     = 3;
> > dojo.dom.CDATA_SECTION_NODE            = 4;
> > dojo.dom.ENTITY_REFERENCE_NODE         = 5;
> > dojo.dom.ENTITY_NODE                   = 6;
> > dojo.dom.PROCESSING_INSTRUCTION_NODE   = 7;
> > dojo.dom.COMMENT_NODE                  = 8;
> > dojo.dom.DOCUMENT_NODE                 = 9;
> > dojo.dom.DOCUMENT_TYPE_NODE            = 10;
> > dojo.dom.DOCUMENT_FRAGMENT_NODE        = 11;
> > dojo.dom.NOTATION_NODE                 = 12;
> >
> > Using these make for much more readable code when doing HTML DOM
> > manipulation. So you might have the following:
> >
> > var top = dojo.byId("top");
> > for (var i = 0; i < top.childNodes.length; i++){
> >         var currentNode = top.childNodes[i];
> >         if (currentNode.nodeType == dojo.dom.ELEMENT_NODE &&
> >                 currentNode.className == "status"){
> >                 top.removeChild(currentNode);
> >         }
> > }
> >
> > rather than just if(currentNode.nodeType == 1)
> >
> > It was a bug in the browsers not to include the standard DOM element
> > node values given by nodeType; they are correctly predefined in
> > Mozilla but not Internet Explorer, which was a bug and which is why
> > everyone uses the numbers in their code versus what the standard said
> > to do. Here are Mozilla's predefined values in the global object Node:
> > http://developer.mozilla.org/en/docs/DOM:element.nodeType , which
> > allowed you to just say Node.ELEMENT_NODE rather than '1'.
> >
> > Can we put these values somewhere in the core?
> >
> > Best,
> >   Brad
> > _______________________________________________
> > dojo-contributors mailing list
> > dojo-contributors at dojotoolkit.org
> > http://dojotoolkit.org/mailman/listinfo/dojo-contributors
> >
> _______________________________________________
> dojo-contributors mailing list
> dojo-contributors at dojotoolkit.org
> http://dojotoolkit.org/mailman/listinfo/dojo-contributors
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.dojotoolkit.org/pipermail/dojo-contributors/attachments/20070608/3322eb68/attachment.htm 


More information about the dojo-contributors mailing list