On Feb 20, 4:10 am, "Dan Webb" <[EMAIL PROTECTED]> wrote:
> The thing is is that there's loads of cross browser problems with
> setting attributes (as mentioned previously) and working around at
> least the common problems with a tool like this is essential otherwise
> your just going to end up sending developers on huge bug hunts almost
> every time they use it which is no help to anyone really. For
> instance, really common attributes like class, for, style, name etc
> all work unpredicable across browsers so if people try to use this
> they'll very quickly realise that its problematic and end up dropping
> it so the end result is that you've just given the developer the run
> around. Im not saying a solution like this needs to be cover every
> single little bug but it should cover the common ones.
The groundwork for managing these special cases has already been laid
with the work Tobie and I did on Element.readAttribute. "Class" and
"for" are easily translated into their necessary "className" and
"htmlFor" in IE. "Name" can be set in the document.createElement call
the way DOMBuilder does. And I think "style" is an edge case that
doesn't really concern me too much.
I'm sure there will be other speed bumps, but I don't think the
tyranny of the edge case is enough to hold this idea down.
> Besides that, in terms of syntaxic sugar Martin's solution, although
> very compact in implementation, doesn't buy the developer much and
> since a DOM builder is all about facilitating building none trivial
> DOM structures with readable code it seems a little redundant. new
> Element('div', ....) then creating all the childNodes and appending
> each is just not much better than document.createElement().
This is a point I raised earlier in the thread, but later withdrew.
Martin's solution is not intended to be a replacement of something
like DOMBuilder, but rather an intermediate step toward it.
> It's not been mentioned yet but theres a slightly updated version of
> my DOM Builder in Low Pro and instead of using the apply stuff it
> creates the functions with a $ prefixed which I thought was more
> Prototypish. $span, $div etc. It also does fix the most common bugs
> (but not as much as the scriptaculous version which is very thorough)
> and is pretty small. Predictably, my vote would go for my version :)
>
> http://svn.danwebb.net/external/lowpro/trunk/src/dom.js
I'm conflicted about this. I realize that DOM building convenience
methods are only convenient when the names are short, but at the same
time I worry about dropping into the $ namespace the namess of all
elements used in HTML4.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---