[Proto-Scripty] Re: Custom attributes or not custom attributes ?
On Dec 31 2008, 12:05 am, buda wrote: > But to store metadata in objects - is doing overjob - elements might > be added or deleted or changed their style or state - and syncronyze > elmenets state with their object mappers - is very hard and > useless It's not hard at all, and definitely not useless (after all, you want to do it). Consider that DOM elements are simply one way of displaying the data in business objects. Do all of your work with the objects, then send the data to the screen to be viewed. That model separates the business logic from the display logic. Of course there are some functions that are pure UI (e.g. sorting a table or list) but others, like updating the table rows from a server, should be done with an object, then written to the UI. If you only have one table representing a single data object, it probably doesn't matter if you just update the table directly using AJAX or similar, but once you have a number of data objects and maybe a number of different ways of displaying their content, you will want to separate display from business logic. -- Rob. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Custom attributes or not custom attributes ?
But to store metadata in objects - is doing overjob - elements might be added or deleted or changed their style or state - and syncronyze elmenets state with their object mappers - is very hard and useless On 30 дек, 14:17, RobG wrote: > On Dec 29, 8:38 pm, buda wrote: > > > > It is useful, but I don't think it's worth the trouble and I > > > personally don't use it. IE's DOM is one example of what makes custom > > > attributes troublesome - you never know which issues you will run into > > > due to every custom attribute ending up as a property of an element. > > > What if attribute name (which becomes a property name) is a reserved > > > word (according to ECMAScript/JScript)? What if it corresponds to some > > > IE's proprietary element property? Which of them takes precedence and > > > which issues it might cause? etc. > > > I completle confused at finally - where to store elements metadata? > > DOM elements are designed to provide a user interface, they shouldn't > be used as business objects or to implement business logic. > > > What is the best way? > > Use javascript objects, use DOM elements and events to interact with > the user. > > -- > Rob --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Custom attributes or not custom attributes ?
On Dec 29, 8:38 pm, buda wrote: > > It is useful, but I don't think it's worth the trouble and I > > personally don't use it. IE's DOM is one example of what makes custom > > attributes troublesome - you never know which issues you will run into > > due to every custom attribute ending up as a property of an element. > > What if attribute name (which becomes a property name) is a reserved > > word (according to ECMAScript/JScript)? What if it corresponds to some > > IE's proprietary element property? Which of them takes precedence and > > which issues it might cause? etc. > > I completle confused at finally - where to store elements metadata? DOM elements are designed to provide a user interface, they shouldn't be used as business objects or to implement business logic. > What is the best way? Use javascript objects, use DOM elements and events to interact with the user. -- Rob --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Custom attributes or not custom attributes ?
> It is useful, but I don't think it's worth the trouble and I > personally don't use it. IE's DOM is one example of what makes custom > attributes troublesome - you never know which issues you will run into > due to every custom attribute ending up as a property of an element. > What if attribute name (which becomes a property name) is a reserved > word (according to ECMAScript/JScript)? What if it corresponds to some > IE's proprietary element property? Which of them takes precedence and > which issues it might cause? etc. > I completle confused at finally - where to store elements metadata? What is the best way? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Custom attributes or not custom attributes ?
On Dec 27, 8:51 pm, buda wrote: > > Of course not: > > > > "http://www.w3.org/TR/html4/strict.dtd";> > > > > > > > > > > // writes "CSS1Compat" (would print "BackCompat" in Quirks) > > document.write(document.compatMode); > > > > > > > > but this document does not pass validation - "Error found while > checking this document as HTML 4.01 Strict!" Of course it doesn't. That's because there are invalid attributes, yet you can see how browser still renders document in standard mode. That was exactly the point of this example. You just need to understand that invalid markup and mode switching have nothing to do with each other ; ) > what does this mean for the browser and why should I well form my > document if tere is not difference correct it or not - its in every > case strict document!? You could ask that at c.i.w.a.html [1] > > > Nevertheless, try not to use custom attributes, unless you want to run > > into troubles later on (e.g. remember that the entire DOM in IE is > > implemented in such way that there's no distinction between element > > attributes and properties). > > I dont fully understand what you mean - "> e.g. remember that the > entire DOM in IE is > > > implemented in such way that there's no distinction between element > > attributes and properties)." > > and how should I do in case when I need to somewhere to storemetadata > about every element in a form to make some validation or save their > states? or manipulate with them in case of some rules state in my > bussines rules > > Earlie you sad "It is indeed useful" about custom attributes and now > you tell me not to use them ?! > What should I do instead of storin some metadat in elements custom > attributes??? It is useful, but I don't think it's worth the trouble and I personally don't use it. IE's DOM is one example of what makes custom attributes troublesome - you never know which issues you will run into due to every custom attribute ending up as a property of an element. What if attribute name (which becomes a property name) is a reserved word (according to ECMAScript/JScript)? What if it corresponds to some IE's proprietary element property? Which of them takes precedence and which issues it might cause? etc. [1] http://groups.google.com/group/comp.infosystems.www.authoring.html/topics --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Custom attributes or not custom attributes ?
and what I need to add - I dont add custom attribute by element.writeAttribute(...) I do - element.required = true; As I noted there is no difference - when then I try to see "runtime" HTML it contains custom attribute required="true" Am I right? and what to do to do the best? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Custom attributes or not custom attributes ?
> Of course not: > > "http://www.w3.org/TR/html4/strict.dtd";> > > > > > // writes "CSS1Compat" (would print "BackCompat" in Quirks) > document.write(document.compatMode); > > > > but this document does not pass validation - "Error found while checking this document as HTML 4.01 Strict!" what does this mean for the browser and why should I well form my document if tere is not difference correct it or not - its in every case strict document!? > Nevertheless, try not to use custom attributes, unless you want to run > into troubles later on (e.g. remember that the entire DOM in IE is > implemented in such way that there's no distinction between element > attributes and properties). > I dont fully understand what you mean - "> e.g. remember that the entire DOM in IE is > implemented in such way that there's no distinction between element > attributes and properties)." and how should I do in case when I need to somewhere to storemetadata about every element in a form to make some validation or save their states? or manipulate with them in case of some rules state in my bussines rules Earlie you sad "It is indeed useful" about custom attributes and now you tell me not to use them ?! What should I do instead of storin some metadat in elements custom attributes??? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Custom attributes or not custom attributes ?
On Dec 27, 6:27 pm, buda wrote: > > If document is declared as strict or transitional it must validate > > against corresponding DTD's in order to be valid. When there's no > > declaration, there's nothing to validate against. If quirks mode is > > triggered by lack of doctype declaration, then validity does not even > > apply, since there's no declaration to validate against. Am I missing > > something? > > But if I decleared strict or transitional and then add a custom > attribute to an element - the browser swithes to quirck mode or Iam > wrong? Of course not: http://www.w3.org/TR/html4/strict.dtd";> // writes "CSS1Compat" (would print "BackCompat" in Quirks) document.write(document.compatMode); > > > > > > > It is indeed useful. HTML5 even introduced custom data-* attributes > > > > [1] > > > > When will it the standard? > > > 2022 > > Huh? we have enough time to fell free ) I'm sure we'll see different browsers implement most of html5 features long before this revision becomes a recommendation. Some of them are already present in modern browsers (e.g. `document.getElementsByClassName` or `document.querySelector`). Nevertheless, try not to use custom attributes, unless you want to run into troubles later on (e.g. remember that the entire DOM in IE is implemented in such way that there's no distinction between element attributes and properties). -- kangax --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Custom attributes or not custom attributes ?
> If document is declared as strict or transitional it must validate > against corresponding DTD's in order to be valid. When there's no > declaration, there's nothing to validate against. If quirks mode is > triggered by lack of doctype declaration, then validity does not even > apply, since there's no declaration to validate against. Am I missing > something? But if I decleared strict or transitional and then add a custom attribute to an element - the browser swithes to quirck mode or Iam wrong? > > > > It is indeed useful. HTML5 even introduced custom data-* attributes > > > [1] > > > When will it the standard? > > 2022 Huh? we have enough time to fell free ) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Custom attributes or not custom attributes ?
On Dec 27, 1:56 pm, buda wrote: > > No. Quirks mode is triggered by the lack of doctype declaration, not > > the presence of custom attributes. IE is the only exception in that it > > *also* triggers quirks when anything non-whitespace precedes doctype > > declaration. > > If document is decleared as strict or transitional - it must be valid > - otherwise it switch to quirck mode - am I right > Custom attributes are not valid in thiese modes only in quirck mode If document is declared as strict or transitional it must validate against corresponding DTD's in order to be valid. When there's no declaration, there's nothing to validate against. If quirks mode is triggered by lack of doctype declaration, then validity does not even apply, since there's no declaration to validate against. Am I missing something? > > It is indeed useful. HTML5 even introduced custom data-* attributes > > [1] > > When will it the standard? 2022 > > > I think you should use class attributes or some alternative approach, > > and keep your markup valid. On a side note, there's a data > > manipulation addition in prototype's trunk; Element#store and > > Element#retrieve. You might want to look into that. > > Element#store, Element#retrieve - where can I view it? http://github.com/sstephenson/prototype/tree/master/src/dom/dom.js#L1221 [...] -- kangax --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Custom attributes or not custom attributes ?
> No. Quirks mode is triggered by the lack of doctype declaration, not > the presence of custom attributes. IE is the only exception in that it > *also* triggers quirks when anything non-whitespace precedes doctype > declaration. If document is decleared as strict or transitional - it must be valid - otherwise it switch to quirck mode - am I right Custom attributes are not valid in thiese modes only in quirck mode > > It is indeed useful. HTML5 even introduced custom data-* attributes > [1] > When will it the standard? > I think you should use class attributes or some alternative approach, > and keep your markup valid. On a side note, there's a data > manipulation addition in prototype's trunk; Element#store and > Element#retrieve. You might want to look into that. Element#store, Element#retrieve - where can I view it? > -- > kangax --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Custom attributes or not custom attributes ?
On Dec 27, 6:15 am, buda wrote: > From one hand - custom attributes, if they are not described in DTD, > are evil for valid Transitional or Strict modes - they lead document > to quirck mode No. Quirks mode is triggered by the lack of doctype declaration, not the presence of custom attributes. IE is the only exception in that it *also* triggers quirks when anything non-whitespace precedes doctype declaration. > > From another hand - they make the life easy for developers with their > ability to store a lot of metadata like: required="true" mask="^w+..." > oldValue="345" emptyVlue="0" min="10" max="1000" rowID="1213" and etc It is indeed useful. HTML5 even introduced custom data-* attributes [1] > > there is an offer to store whole metadata into css classname attribute > (it maybe a very long string with keypairs) - which as for me its very > very complex to analyze and modify > > What do you think about it? I think you should use class attributes or some alternative approach, and keep your markup valid. On a side note, there's a data manipulation addition in prototype's trunk; Element#store and Element#retrieve. You might want to look into that. [1] http://www.whatwg.org/specs/web-apps/current-work/#custom-data-attribute -- kangax --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Custom attributes or not custom attributes ?
for pros - article http://unspace.ca/discover/attributes/ On 27 дек, 13:15, buda wrote: > From one hand - custom attributes, if they are not described in DTD, > are evil for valid Transitional or Strict modes - they lead document > to quirck mode > > From another hand - they make the life easy for developers with their > ability to store a lot of metadata like: required="true" mask="^w+..." > oldValue="345" emptyVlue="0" min="10" max="1000" rowID="1213" and etc > > there is an offer to store whole metadata into css classname attribute > (it maybe a very long string with keypairs) - which as for me its very > very complex to analyze and modify > > What do you think about it? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Custom attributes or not custom attributes ?
I have added that $('total').oldValue = $('total').getValue(); its also custom attribute On 27 дек, 13:15, buda wrote: > From one hand - custom attributes, if they are not described in DTD, > are evil for valid Transitional or Strict modes - they lead document > to quirck mode > > From another hand - they make the life easy for developers with their > ability to store a lot of metadata like: required="true" mask="^w+..." > oldValue="345" emptyVlue="0" min="10" max="1000" rowID="1213" and etc > > there is an offer to store whole metadata into css classname attribute > (it maybe a very long string with keypairs) - which as for me its very > very complex to analyze and modify > > What do you think about it? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---