Custom attributes in Dojo?

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Custom attributes in Dojo?

CrisP
Hi,

Personally I like the way Dojo is designed to accept custom attributes
for DOM elements that represent Dojo widgets, but this prevents the HTML
from validating cleanly, and validation seems to be important to many
designers.

The dojoType attribute of course has alternate representations, but I'm
not aware of other options when using widgets, except to not define the
widget inline at all.  Have any of you considered alternative ways to
enter this information inline?  I have a scheme that seems to have some
good points, and wondered if you see any problems with this:

The W3 HTML 4.0 standard defines "class" as a "cdata-list", with classes
separated by whitespace.  I've tried supplying fake classes such as
foo=bar or delay:500 in class attributes, and they work in Mozilla, IE6,
and Safari at least.  Plus they don't seem to get interpreted as a class
of "foo" or a class of "bar".

The W3C HTML validator also accepts documents with this stuff in them.

Does anybody see a fatal flaw in this approach, other than potential
issues if the widget attribute's value needs to have white space in it?

Thanks,
Cris

_______________________________________________
Dojo-interest mailing list
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Custom attributes in Dojo?

Christopher Smith
Cris Perdue wrote:

> Hi,
>
> Personally I like the way Dojo is designed to accept custom attributes
> for DOM elements that represent Dojo widgets, but this prevents the
> HTML from validating cleanly, and validation seems to be important to
> many designers.
>
> The dojoType attribute of course has alternate representations, but
> I'm not aware of other options when using widgets, except to not
> define the widget inline at all.  Have any of you considered
> alternative ways to enter this information inline?  I have a scheme
> that seems to have some good points, and wondered if you see any
> problems with this:
>
> The W3 HTML 4.0 standard defines "class" as a "cdata-list", with
> classes separated by whitespace.  I've tried supplying fake classes
> such as foo=bar or delay:500 in class attributes, and they work in
> Mozilla, IE6, and Safari at least.  Plus they don't seem to get
> interpreted as a class of "foo" or a class of "bar".
>
> The W3C HTML validator also accepts documents with this stuff in them.
>
> Does anybody see a fatal flaw in this approach, other than potential
> issues if the widget attribute's value needs to have white space in it?
>
> Thanks,
> Cris
Hi,

I'm new to Dojo, but I value validation highly & separation of content
from presentation/behaviour. I ran into this issue straight away, I
believe there are two solutions, I haven't had a go at the second one yet.
- keep behaviour separate from content, set the properties in a
javascript file through a function connected to the onload event.  This
works ok and is really no more clunky that styling things specifically
via id's in your CSS file.  Effectively you have a js file which will in
someway consist of DOM ids and Dojo information related to that ID.

- use the object tag and param elements to hold the information (I
haven't tried this yet).

I hope this helps.

Cheers,

Chris
_______________________________________________
Dojo-interest mailing list
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Custom attributes in Dojo?

Bill Keese-2
In reply to this post by CrisP
The other approach is to use namespaces for the attributes:

        <div class="dojo-Tab" dojo:caption="Inventory">

Bill

Cris Perdue wrote:

> Hi,
>
> Personally I like the way Dojo is designed to accept custom attributes
> for DOM elements that represent Dojo widgets, but this prevents the HTML
> from validating cleanly, and validation seems to be important to many
> designers.
>
> The dojoType attribute of course has alternate representations, but I'm
> not aware of other options when using widgets, except to not define the
> widget inline at all.  Have any of you considered alternative ways to
> enter this information inline?  I have a scheme that seems to have some
> good points, and wondered if you see any problems with this:
>
> The W3 HTML 4.0 standard defines "class" as a "cdata-list", with classes
> separated by whitespace.  I've tried supplying fake classes such as
> foo=bar or delay:500 in class attributes, and they work in Mozilla, IE6,
> and Safari at least.  Plus they don't seem to get interpreted as a class
> of "foo" or a class of "bar".
>
> The W3C HTML validator also accepts documents with this stuff in them.
>
> Does anybody see a fatal flaw in this approach, other than potential
> issues if the widget attribute's value needs to have white space in it?
>
> Thanks,
> Cris
>
> _______________________________________________
> Dojo-interest mailing list
> [hidden email]
> http://dojotoolkit.org/mailman/listinfo/dojo-interest
_______________________________________________
Dojo-interest mailing list
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Custom attributes in Dojo?

Bill Keese-2
In reply to this post by Christopher Smith
> - use the object tag and param elements to hold the information (I
> haven't tried this yet).

Using the object tag as the widget type seems like the  obvious way to
do things but I've been told that it doesn't work in IE, and it doesn't
work for widgets without a template.  It also doesn't degrade gracefully
if the user has disabled javascript.
_______________________________________________
Dojo-interest mailing list
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Custom attributes in Dojo?

Bugzilla from michael@schuerig.de
In reply to this post by CrisP
On Tuesday 13 December 2005 22:27, Cris Perdue wrote:

> The W3 HTML 4.0 standard defines "class" as a "cdata-list", with
> classes separated by whitespace.  I've tried supplying fake classes
> such as foo=bar or delay:500 in class attributes, and they work in
> Mozilla, IE6, and Safari at least.  Plus they don't seem to get
> interpreted as a class of "foo" or a class of "bar".
>
> The W3C HTML validator also accepts documents with this stuff in
> them.
>
> Does anybody see a fatal flaw in this approach, other than potential
> issues if the widget attribute's value needs to have white space in
> it?

I'm using this approach, among other things, for a JavaScript form
validator. There, I have elements such as

  <input type="text" class="mandatory maxlength:255"></input>

where the class attribute is interpreted by the validator.

The general form is <name>:<URI-encoded value>

So far, I haven't experienced any problems. However, I'd like to add,
that I'd prefer an approach with properly namespaced attributes, but
I'm not quite sure how exactly to do this.

Michael

--
Michael Schuerig                              Life is just as deadly
mailto:[hidden email]                               As it looks
http://www.schuerig.de/michael/          --Richard Thompson, Sibella
_______________________________________________
Dojo-interest mailing list
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Custom attributes in Dojo?

Alex Russell
In reply to this post by Bill Keese-2
This was broken. I just fixed it in r2466. It will be available for
widget authors who wish to validate when we release 0.2.

Regards

On Tuesday 13 December 2005 2:29 pm, Bill Keese wrote:
> The other approach is to use namespaces for the attributes:
>
> <div class="dojo-Tab" dojo:caption="Inventory">
>
> Bill

--
Alex Russell
[hidden email] BE03 E88D EABB 2116 CC49 8259 CF78 E242 59C3 9723
[hidden email]  F687 1964 1EF6 453E 9BD0 5148 A15D 1D43 AB92 9A46
_______________________________________________
Dojo-interest mailing list
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Custom attributes in Dojo?

CrisP
Hi,

Thanks Bill and Alex for the comments and pointers, and for the fix to
support namespaced attributes.

I've tried a tiny sample file on the W3C validator, but the file doesn't
pass, neither as HTML 4.01 Transitional, nor Strict, nor as XHML 1.0
Transitional, all because of the namespaced attribute.

In any case, the W3 validator doesn't accept new namespaced attributes,
and it doesn't complain about the DTD if I give a dummy DTD URL -- it
only complains it doesn't understand the namespaced attributes,
including <html xmlns:dojo="...">.   As if maybe it doesn't even know
how to handle the declaration.

Is there an easy way out of all of this?  It looks like there are some
practical obstacles here beyond the theoretical ones.

Thanks for any help,
Cris

_______________________________________________
Dojo-interest mailing list
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Custom attributes in Dojo?

David Schontzler
Personally, I don't use the HTML validators because they have no
relevance... they aren't a client I ship things to; unlike a browser
or XML parsers. If I need to validate something, I just toss it open
in something that understands XML (Firefox and IE work fine if it is
.xml) and use that as a guide. Once I know my doc is well-formed, I'm
good to go.

-d

On 12/13/05, Cris Perdue <[hidden email]> wrote:

> Hi,
>
> Thanks Bill and Alex for the comments and pointers, and for the fix to
> support namespaced attributes.
>
> I've tried a tiny sample file on the W3C validator, but the file doesn't
> pass, neither as HTML 4.01 Transitional, nor Strict, nor as XHML 1.0
> Transitional, all because of the namespaced attribute.
>
> In any case, the W3 validator doesn't accept new namespaced attributes,
> and it doesn't complain about the DTD if I give a dummy DTD URL -- it
> only complains it doesn't understand the namespaced attributes,
> including <html xmlns:dojo="...">.   As if maybe it doesn't even know
> how to handle the declaration.
>
> Is there an easy way out of all of this?  It looks like there are some
> practical obstacles here beyond the theoretical ones.
>
> Thanks for any help,
> Cris
>
> _______________________________________________
> Dojo-interest mailing list
> [hidden email]
> http://dojotoolkit.org/mailman/listinfo/dojo-interest
>
_______________________________________________
Dojo-interest mailing list
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Custom attributes in Dojo?

iTorrey
Administrator
My quick two cents on this.

I tend to agree with David's view on this.

I also am not sure that class overloading is better than having something that doesn't validate. To me, you are trading
something that works the way it's supposed to for something that works as a side effect just for the sake of validation.

It isn't the function or intention of the class attribute to provide bits of javascript so I find it odd that the
proposed solution to non-validating markup is to mangle things in another less than standard way just because it works
and validates.

To me validation isn't a set in stone rule set that I have to follow over a cliff. Validation has its purposes but no
real relevance to the question of "does it work or not" which in the end is what the paying client and user both want
from me.



-Torrey


David Schontzler wrote:

> Personally, I don't use the HTML validators because they have no
> relevance... they aren't a client I ship things to; unlike a browser
> or XML parsers. If I need to validate something, I just toss it open
> in something that understands XML (Firefox and IE work fine if it is
> .xml) and use that as a guide. Once I know my doc is well-formed, I'm
> good to go.
>
> -d
>
> On 12/13/05, Cris Perdue <[hidden email]> wrote:
>> Hi,
>>
>> Thanks Bill and Alex for the comments and pointers, and for the fix to
>> support namespaced attributes.
>>
>> I've tried a tiny sample file on the W3C validator, but the file doesn't
>> pass, neither as HTML 4.01 Transitional, nor Strict, nor as XHML 1.0
>> Transitional, all because of the namespaced attribute.
>>
>> In any case, the W3 validator doesn't accept new namespaced attributes,
>> and it doesn't complain about the DTD if I give a dummy DTD URL -- it
>> only complains it doesn't understand the namespaced attributes,
>> including <html xmlns:dojo="...">.   As if maybe it doesn't even know
>> how to handle the declaration.
>>
>> Is there an easy way out of all of this?  It looks like there are some
>> practical obstacles here beyond the theoretical ones.
>>
>> Thanks for any help,
>> Cris
>>
>> _______________________________________________
>> Dojo-interest mailing list
>> [hidden email]
>> http://dojotoolkit.org/mailman/listinfo/dojo-interest
>>
> _______________________________________________
> Dojo-interest mailing list
> [hidden email]
> http://dojotoolkit.org/mailman/listinfo/dojo-interest
>
>
_______________________________________________
Dojo-interest mailing list
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Custom attributes in Dojo?

CrisP
Hi David, Torrey,

Well personally I like the custom attributes.  In theory the computer
and the software are supposed to be serving us, not the other way
around, right?

Cheers,
Cris

_______________________________________________
Dojo-interest mailing list
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest
Loading...