Re: possible errors in [Client-side Scripting Techniques: 2.2 Dynamic content generation]

Dear Olivier,

Thank you for your comments on the 30 June 2005 Working Draft of WCAG
2.0. I've added your comments script techniques to our issues database.

<http://trace.wisc.edu/bugzilla_wcag/show_bug.cgi?id=1751>

If you have any questions about the issues list interface, please let us 
know.

Thank you for your patience while the WCAG WG responds to the variety
of comments we received on this last Working Draft.

All the best,

-Ben

-- 
Ben Caldwell | <caldwell@trace.wisc.edu>
Trace Research and Development Center <http://trace.wisc.edu>


olivier Thereaux wrote:
> 
> Hello WCAG editors!
> 
> I am not a DOM expert, by far, so this comment is to be taken with a lot 
> of caution, but I think the "good practice" example in [Client-side 
> Scripting Techniques: 2.2 Dynamic content generation] (from the W3C 
> Working Draft 30 June 2005) is wrong in a couple of aspects:
> 
> * [[ para.insertText("Lorem ipsum dolor sit amet"); ]]
> this seems wrong, or at least I can't find its reference anywhere in the 
> DOM specs.
> I suggest:
> [[
> var text = document.createTextNode("Lorem ipsum dolor sit amet");
> para.appendChild(text);
> ]]
> 
> * idem for the list, which is also wrong because of mistakes in 
> appendChild'ing
> Instead of
> [[
>         var list = document.createElement("ul");
>         itemone = document.createElement("li");
>         itemonelink = document.createElement("a");
>         itemonelink.setAttribute("href","foo.html");
>         itemonelink.insertText("foo");
>         list.appendChild(itemone);
> ]]
> the correct script would be, I think (with extra title for the link -- 
> you may change the text ;) but this is an example of setting several 
> attributes, and title for a href's isn't a bad case where that would be 
> needed):
> [[
>         var list = document.createElement("ul");
>         var itemone = document.createElement("li");
>         var itemonelink = document.createElement("a");
>         itemonelink.setAttribute("href","foo.html");
>         itemonelink.setAttribute("title", "CLICK HERE!!!");
>         var linktext =document.createTextNode("foo");
>         itemonelink.appendChild(linktext);
>         itemone.appendChild(itemonelink);
>         list.appendChild(itemone);
> ]]
> 
> I hope my suggestions aren't terribly wrong, and I hope they help.
> Regards,

Received on Friday, 2 September 2005 13:53:55 UTC