Re: [jQuery] Of extendos, metadata and valid XHMTL - Is it ok to add attributes to elements?

2007-03-05 Thread Jörn Zaefferer
Daemach schrieb:
 Thanks for the info on the metadata plugin.

 Make sure to avoid any spaces... is exactly the kind of gotcha that
 makes using classes as a data repository so troublesome.  While it is
 technically possible, mixing data types inside an attribute just feels like
 a bad practice to me.
   
Sure thing. The validation plugin offers metadata as an option, and 
doesn't rely on it at all. So it is up to the user to decide what works 
best for him.

Though since the first release of the validation plugin my opinions 
about metadata changed quite a lot. Currently I'd recommend to put any 
validation rules completely in JavaScript.

-- 
Jörn Zaefferer

http://bassistance.de


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Of extendos, metadata and valid XHMTL - Is it ok to add attributes to elements?

2007-03-04 Thread Klaus Hartl
Daemach schrieb:
 Your faith in Microsoft is certainly admirable, but the very fact that we're
 talking about storing 2 kinds of information in a single attribute is cause
 for concern isn't it?  Thinking about the way parsers work in general, an
 extra attribute in an element seems less likely to be a problem than
 unexpected information in an attribute defined by the W3 specs 

Yeah, and I immediately imagine people that use some attributes that are 
supposed to be not used by MS and suddenly its an XForms attribute that 
is already implemented by - oh - Opera.

http://my.opera.com/hallvors/blog/show.dml/476181


-- Klaus


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Of extendos, metadata and valid XHMTL - Is it ok to add attributes to elements?

2007-03-04 Thread Klaus Hartl
Ⓙⓐⓚⓔ schrieb:
 have you ever made a dtd that the validator likes? I gave up on that a
 while back!
 
 good luck!

Yes, unless you don't use *real* xml/xhtml there's not a real chance to 
have a validator ever use your specified dtd. so the whole thing is kind 
of theoretical.


-- klaus

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Of extendos, metadata and valid XHMTL - Is it ok to add attributes to elements?

2007-03-04 Thread Daemach

My main issue, I think, is that I don't like the idea of mixing 2 different
types of data in one attribute.  I like keeping everything separated, but
that's just me ;)



Klaus Hartl wrote:
 
 Ⓙⓐⓚⓔ schrieb:
 I think there is no risk! classes are ours to use (or abuse)... no
 sane (not even IE) browser would co-opt classes from the masses!
 
 Yes, Jake is right of course. As long you know what classes you use, 
 what's the problem?
 
 
 -- Klaus
 
 ___
 jQuery mailing list
 discuss@jquery.com
 http://jquery.com/discuss/
 
 

-- 
View this message in context: 
http://www.nabble.com/Of-extendos%2C-metadata-and-valid-XHMTL---Is-it-ok-to-add-attributes-to-elements--tf3337204.html#a9297679
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Of extendos, metadata and valid XHMTL - Is it ok to add attributes to elements?

2007-03-04 Thread Jörn Zaefferer
Daemach schrieb:
 Actually I think I may just modify the validator code to read out of a custom
 expando.  It would be nice to be able to pass the attribute name to the
 validator engine directly though...

 Jorn?  ==(sorry - I don't know how to do the fancy o ;)
   
Heh, . Just copypaste the next time you need it ;)

Actually the custom attribute is already supported: Just tell the 
metadata plugin to do so, and the validator uses it.

Put this in front of any other code that uses the metadata (eg. validation):
$.meta.setType(attr, validate)
And replace validate with anything you like as a custom attribute.

In case you need to use the classes, make sure to avoid any spaces, eg. 
class={require:true,email:true} can't be confused by any browser with 
any actual style class, because the curly braces are illegal characters 
for style classes.

-- 
Jörn Zaefferer

http://bassistance.de


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Of extendos, metadata and valid XHMTL - Is it ok to add attributes to elements?

2007-03-04 Thread Daemach

Thanks for the info on the metadata plugin.

Make sure to avoid any spaces... is exactly the kind of gotcha that
makes using classes as a data repository so troublesome.  While it is
technically possible, mixing data types inside an attribute just feels like
a bad practice to me.



Jörn Zaefferer wrote:
 
 Daemach schrieb:
 Actually I think I may just modify the validator code to read out of a
 custom
 expando.  It would be nice to be able to pass the attribute name to the
 validator engine directly though...

 Jorn?  ==(sorry - I don't know how to do the fancy o ;)
   
 Heh, . Just copypaste the next time you need it ;)
 
 Actually the custom attribute is already supported: Just tell the 
 metadata plugin to do so, and the validator uses it.
 
 Put this in front of any other code that uses the metadata (eg.
 validation):
 $.meta.setType(attr, validate)
 And replace validate with anything you like as a custom attribute.
 
 In case you need to use the classes, make sure to avoid any spaces, eg. 
 class={require:true,email:true} can't be confused by any browser with 
 any actual style class, because the curly braces are illegal characters 
 for style classes.
 
 -- 
 Jörn Zaefferer
 
 http://bassistance.de
 
 
 ___
 jQuery mailing list
 discuss@jquery.com
 http://jquery.com/discuss/
 
 

-- 
View this message in context: 
http://www.nabble.com/Of-extendos%2C-metadata-and-valid-XHMTL---Is-it-ok-to-add-attributes-to-elements--tf3337204.html#a9303474
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Of extendos, metadata and valid XHMTL - Is it ok to add attributes to elements?

2007-03-03 Thread Klaus Hartl
Daemach schrieb:
 --  If I add metadata to a class attribute, I risk messing with CSS -
 classes are for styles.

That is a common misunderstanding. Consider the HTML spec:

The class attribute has several roles in HTML:

 * As a style sheet selector (when an author wishes to assign style 
information to a set of elements).
 * For general purpose processing by user agents.

http://www.w3.org/TR/html401/struct/global.html#h-7.5.2



-- Klaus


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Of extendos, metadata and valid XHMTL - Is it ok to add attributes to elements?

2007-03-03 Thread Ⓙⓐⓚⓔ
call me weird, but I like mixing the 2 types of classes , and often
use them together, with a single class.

On 3/3/07, Klaus Hartl [EMAIL PROTECTED] wrote:
 Daemach schrieb:
  --  If I add metadata to a class attribute, I risk messing with CSS -
  classes are for styles.

 That is a common misunderstanding. Consider the HTML spec:

 The class attribute has several roles in HTML:

  * As a style sheet selector (when an author wishes to assign style
 information to a set of elements).
  * For general purpose processing by user agents.

 http://www.w3.org/TR/html401/struct/global.html#h-7.5.2



 -- Klaus


 ___
 jQuery mailing list
 discuss@jquery.com
 http://jquery.com/discuss/



-- 
Ⓙⓐⓚⓔ - יעקב   ʝǡǩȩ   ᎫᎪᏦᎬ
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Of extendos, metadata and valid XHMTL - Is it ok to add attributes to elements?

2007-03-03 Thread Daemach

Well of course we all know that every browser follows the w3 recommendations
rigidly and without compromise, so let me put this another way:

Knowing that some browsers suck more than others (*cough* IE *cough*), is
there less risk in the browser misinterpreting non-style information in an
attribute it normally uses for styles or data in extra attributes that it
doesn't know or care about?



Klaus Hartl wrote:
 
 Daemach schrieb:
 --  If I add metadata to a class attribute, I risk messing with CSS -
 classes are for styles.
 
 That is a common misunderstanding. Consider the HTML spec:
 
 The class attribute has several roles in HTML:
 
  * As a style sheet selector (when an author wishes to assign style 
 information to a set of elements).
  * For general purpose processing by user agents.
 
 http://www.w3.org/TR/html401/struct/global.html#h-7.5.2
 
 
 
 -- Klaus
 
 
 ___
 jQuery mailing list
 discuss@jquery.com
 http://jquery.com/discuss/
 
 

-- 
View this message in context: 
http://www.nabble.com/Of-extendos%2C-metadata-and-valid-XHMTL---Is-it-ok-to-add-attributes-to-elements--tf3337204.html#a9291397
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Of extendos, metadata and valid XHMTL - Is it ok to add attributes to elements?

2007-03-03 Thread Ⓙⓐⓚⓔ
I think there is no risk! classes are ours to use (or abuse)... no
sane (not even IE) browser would co-opt classes from the masses!

On 3/3/07, Daemach [EMAIL PROTECTED] wrote:

 Well of course we all know that every browser follows the w3 recommendations
 rigidly and without compromise, so let me put this another way:

 Knowing that some browsers suck more than others (*cough* IE *cough*), is
 there less risk in the browser misinterpreting non-style information in an
 attribute it normally uses for styles or data in extra attributes that it
 doesn't know or care about?



 Klaus Hartl wrote:
 
  Daemach schrieb:
  --  If I add metadata to a class attribute, I risk messing with CSS -
  classes are for styles.
 
  That is a common misunderstanding. Consider the HTML spec:
 
  The class attribute has several roles in HTML:
 
   * As a style sheet selector (when an author wishes to assign style
  information to a set of elements).
   * For general purpose processing by user agents.
 
  http://www.w3.org/TR/html401/struct/global.html#h-7.5.2
 
 
 
  -- Klaus
 
 
  ___
  jQuery mailing list
  discuss@jquery.com
  http://jquery.com/discuss/
 
 

 --
 View this message in context: 
 http://www.nabble.com/Of-extendos%2C-metadata-and-valid-XHMTL---Is-it-ok-to-add-attributes-to-elements--tf3337204.html#a9291397
 Sent from the JQuery mailing list archive at Nabble.com.


 ___
 jQuery mailing list
 discuss@jquery.com
 http://jquery.com/discuss/



-- 
Ⓙⓐⓚⓔ - יעקב   ʝǡǩȩ   ᎫᎪᏦᎬ
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Of extendos, metadata and valid XHMTL - Is it ok to add attributes to elements?

2007-03-03 Thread Glen Lipka

I'm quoting Mike Alsup from the jQuery 1.1.2 thread, which I thought did a
good job relating to this question:
Based on this info, I feel totally safe using it.  I can't even think of a
reason to use objects in this way, but I am not that complex. :)

*That's correct.  It's safe to store primitives in an expando because
the aren't reference counted for garbage collection.  But objects are
trouble.  An IE memory leak pattern is as simple as this:

var o = document.getElementById('A');
document.getElementById('A').myprop = o;

Jack Slocum has a good blog entry on avoiding memory leaks:

**
http://www.jackslocum.com/blog/2006/10/02/3-easy-steps-to-avoid-javascript-memory-leaks/
*http://www.jackslocum.com/blog/2006/10/02/3-easy-steps-to-avoid-javascript-memory-leaks/


*Mike*
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Of extendos, metadata and valid XHMTL - Is it ok to add attributes to elements?

2007-03-03 Thread Ⓙⓐⓚⓔ
after reading this thread I feel comfortable using my own
'expando'/'extendo' attributes again, and using classes too!

but classes are the only way to pass the validators! If you are
horribly concerned with possible interaction with css classes, you
could remove the javascript class with jquery, add an expando, and
deal with it then! the validators don't care what you do with the dom,
just the html!


On 3/3/07, Daemach [EMAIL PROTECTED] wrote:

 I'm assuming you mean that you're comfortable adding an extra attribute to an
 element - is that correct?


 Glen Lipka wrote:
 
  I'm quoting Mike Alsup from the jQuery 1.1.2 thread, which I thought did a
  good job relating to this question:
  Based on this info, I feel totally safe using it.  I can't even think of a
  reason to use objects in this way, but I am not that complex. :)
 
   *That's correct.  It's safe to store primitives in an expando because
  the aren't reference counted for garbage collection.  But objects are
  trouble.  An IE memory leak pattern is as simple as this:
 
  var o = document.getElementById('A');
  document.getElementById('A').myprop = o;
 
  Jack Slocum has a good blog entry on avoiding memory leaks:
 
  **
  http://www.jackslocum.com/blog/2006/10/02/3-easy-steps-to-avoid-javascript-memory-leaks/
  *http://www.jackslocum.com/blog/2006/10/02/3-easy-steps-to-avoid-javascript-memory-leaks/
 
 
  *Mike*
 
  ___
  jQuery mailing list
  discuss@jquery.com
  http://jquery.com/discuss/
 
 

 --
 View this message in context: 
 http://www.nabble.com/Of-extendos%2C-metadata-and-valid-XHMTL---Is-it-ok-to-add-attributes-to-elements--tf3337204.html#a9292741
 Sent from the JQuery mailing list archive at Nabble.com.


 ___
 jQuery mailing list
 discuss@jquery.com
 http://jquery.com/discuss/



-- 
Ⓙⓐⓚⓔ - יעקב   ʝǡǩȩ   ᎫᎪᏦᎬ
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Of extendos, metadata and valid XHMTL - Is it ok to add attributes to elements?

2007-03-03 Thread Daemach

Actually I think I may just modify the validator code to read out of a custom
expando.  It would be nice to be able to pass the attribute name to the
validator engine directly though...

Jorn?  ==(sorry - I don't know how to do the fancy o ;)



Ⓙⓐⓚⓔ wrote:
 
 after reading this thread I feel comfortable using my own
 'expando'/'extendo' attributes again, and using classes too!
 
 but classes are the only way to pass the validators! If you are
 horribly concerned with possible interaction with css classes, you
 could remove the javascript class with jquery, add an expando, and
 deal with it then! the validators don't care what you do with the dom,
 just the html!
 
 
 On 3/3/07, Daemach [EMAIL PROTECTED] wrote:

 I'm assuming you mean that you're comfortable adding an extra attribute
 to an
 element - is that correct?


 Glen Lipka wrote:
 
  I'm quoting Mike Alsup from the jQuery 1.1.2 thread, which I thought
 did a
  good job relating to this question:
  Based on this info, I feel totally safe using it.  I can't even think
 of a
  reason to use objects in this way, but I am not that complex. :)
 
   *That's correct.  It's safe to store primitives in an expando because
  the aren't reference counted for garbage collection.  But objects are
  trouble.  An IE memory leak pattern is as simple as this:
 
  var o = document.getElementById('A');
  document.getElementById('A').myprop = o;
 
  Jack Slocum has a good blog entry on avoiding memory leaks:
 
  **
 
 http://www.jackslocum.com/blog/2006/10/02/3-easy-steps-to-avoid-javascript-memory-leaks/
 
 *http://www.jackslocum.com/blog/2006/10/02/3-easy-steps-to-avoid-javascript-memory-leaks/
 
 
  *Mike*
 
  ___
  jQuery mailing list
  discuss@jquery.com
  http://jquery.com/discuss/
 
 

 --
 View this message in context:
 http://www.nabble.com/Of-extendos%2C-metadata-and-valid-XHMTL---Is-it-ok-to-add-attributes-to-elements--tf3337204.html#a9292741
 Sent from the JQuery mailing list archive at Nabble.com.


 ___
 jQuery mailing list
 discuss@jquery.com
 http://jquery.com/discuss/

 
 
 -- 
 Ⓙⓐⓚⓔ - יעקב   ʝǡǩȩ   ᎫᎪᏦᎬ
 ___
 jQuery mailing list
 discuss@jquery.com
 http://jquery.com/discuss/
 
 

-- 
View this message in context: 
http://www.nabble.com/Of-extendos%2C-metadata-and-valid-XHMTL---Is-it-ok-to-add-attributes-to-elements--tf3337204.html#a9292864
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Of extendos, metadata and valid XHMTL - Is it ok to add attributes to elements?

2007-03-03 Thread Ⓙⓐⓚⓔ
have you ever made a dtd that the validator likes? I gave up on that a
while back!

good luck!

On 3/3/07, Daemach [EMAIL PROTECTED] wrote:

 Actually I think I may just modify the validator code to read out of a custom
 expando.  It would be nice to be able to pass the attribute name to the
 validator engine directly though...

 Jorn?  ==(sorry - I don't know how to do the fancy o ;)



 Ⓙⓐⓚⓔ wrote:
 
  after reading this thread I feel comfortable using my own
  'expando'/'extendo' attributes again, and using classes too!
 
  but classes are the only way to pass the validators! If you are
  horribly concerned with possible interaction with css classes, you
  could remove the javascript class with jquery, add an expando, and
  deal with it then! the validators don't care what you do with the dom,
  just the html!
 
 
  On 3/3/07, Daemach [EMAIL PROTECTED] wrote:
 
  I'm assuming you mean that you're comfortable adding an extra attribute
  to an
  element - is that correct?
 
 
  Glen Lipka wrote:
  
   I'm quoting Mike Alsup from the jQuery 1.1.2 thread, which I thought
  did a
   good job relating to this question:
   Based on this info, I feel totally safe using it.  I can't even think
  of a
   reason to use objects in this way, but I am not that complex. :)
  
*That's correct.  It's safe to store primitives in an expando because
   the aren't reference counted for garbage collection.  But objects are
   trouble.  An IE memory leak pattern is as simple as this:
  
   var o = document.getElementById('A');
   document.getElementById('A').myprop = o;
  
   Jack Slocum has a good blog entry on avoiding memory leaks:
  
   **
  
  http://www.jackslocum.com/blog/2006/10/02/3-easy-steps-to-avoid-javascript-memory-leaks/
  
  *http://www.jackslocum.com/blog/2006/10/02/3-easy-steps-to-avoid-javascript-memory-leaks/
  
  
   *Mike*
  
   ___
   jQuery mailing list
   discuss@jquery.com
   http://jquery.com/discuss/
  
  
 
  --
  View this message in context:
  http://www.nabble.com/Of-extendos%2C-metadata-and-valid-XHMTL---Is-it-ok-to-add-attributes-to-elements--tf3337204.html#a9292741
  Sent from the JQuery mailing list archive at Nabble.com.
 
 
  ___
  jQuery mailing list
  discuss@jquery.com
  http://jquery.com/discuss/
 
 
 
  --
  Ⓙⓐⓚⓔ - יעקב   ʝǡǩȩ   ᎫᎪᏦᎬ
  ___
  jQuery mailing list
  discuss@jquery.com
  http://jquery.com/discuss/
 
 

 --
 View this message in context: 
 http://www.nabble.com/Of-extendos%2C-metadata-and-valid-XHMTL---Is-it-ok-to-add-attributes-to-elements--tf3337204.html#a9292864
 Sent from the JQuery mailing list archive at Nabble.com.


 ___
 jQuery mailing list
 discuss@jquery.com
 http://jquery.com/discuss/



-- 
Ⓙⓐⓚⓔ - יעקב   ʝǡǩȩ   ᎫᎪᏦᎬ
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/