use id rather than class for xforms-loading-* spans

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

use id rather than class for xforms-loading-* spans

Adrian Baker-2
Can I suggest that the spans for the 3 xforms-loading-loading,
xforms-loading-error & xforms-loading-none spans be given id's rather
than classes?

I want to relocate these in theme.xsl (I imagine this is pretty common),
and it seems pretty expensive to have to match on the class
    <xsl:template match="xhtml:span[tokenize(@class, '
')='xforms-loading-loading']">

I'd feel much better matching by:
    <xsl:template match="xhtml:span[@id='xforms-loading-loading']">

and just using
    #xforms-loading-loading

in CSS.

Adrian





--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: use id rather than class for xforms-loading-* spans

Adrian Baker-2
It seems I spoke too soon - it's not actually possible to relocate the xforms-loading-* spans, because they're manually extracted from the DOM from under the <form> element:

// This is a XForms form
document.xformsForm = form;
document.xformsLoadingLoading = null;
document.xformsLoadingError = null;
document.xformsLoadingNone = null;
var spans = form.getElementsByTagName("span");
for (var spanIndex = 0; spanIndex < spans.length; spanIndex++) {
    if (spans[spanIndex].className == "xforms-loading-loading")
        document.xformsLoadingLoading = spans[spanIndex];
    if (spans[spanIndex].className == "xforms-loading-error")
        document.xformsLoadingError = spans[spanIndex];
    if (spans[spanIndex].className == "xforms-loading-none")
        document.xformsLoadingNone = spans[spanIndex];
}

This is a bit unfortunate - if we used id's we could get these out a little more safely with:

document.xformsLoadingLoading = document.getElementById("xforms-loading-loading");
document.xformsLoadingError = document.getElementById("xforms-loading-error");
document.xformsLoadingNone = document.getElementById("xforms-loading-none");

Adrian



Adrian Baker wrote:
Can I suggest that the spans for the 3 xforms-loading-loading, xforms-loading-error & xforms-loading-none spans be given id's rather than classes?
I want to relocate these in theme.xsl (I imagine this is pretty common), and it seems pretty expensive to have to match on the class
   <xsl:template match="xhtml:span[tokenize(@class, ' ')='xforms-loading-loading']">

I'd feel much better matching by:
   <xsl:template match="xhtml:span[@id='xforms-loading-loading']">

and just using
   #xforms-loading-loading

in CSS.

Adrian





______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email ______________________________________________________________________

-- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: [hidden email] For general help: [hidden email] ObjectWeb mailing lists service home page: http://www.objectweb.org/wws



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: use id rather than class for xforms-loading-* spans

Alessandro  Vernet
Administrator
On 4/5/06, Adrian Baker <[hidden email]> wrote:
>  It seems I spoke too soon - it's not actually possible to relocate the
> xforms-loading-* spans, because they're manually extracted from the DOM from
> under the <form> element:
>  [...]

Hi Adrian,

I agree: it makes sense to use ids for those spans, and then get the
elements by id in the JavaScript. Feel free to go ahead with those
modifications, send us the files you have modified, and we'll
integrate those changes in the source tree.

There was a reason for using class initially, but that reason is not
valid anymore today, so I won't go into this :).

Alex
--
Blog (XML, Web apps, Open Source):
http://www.orbeon.com/blog/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet