Hey all, I''ve had these functions for some time now, and would like to offer them as two new dollar-sign functions - elements to be extended by Prototype geniuses. :-) makeText(string) as $T() - return text node element Does just what it says... I''m sure someone could extend it nicely when via Prototype. (example) var x = $T(''hello world''); xElement(tagname) as $E() - return DOM element * return element, when tagname is a string - via ".createElement()" * return (deep) clone, when tagname is already a DOM element $E processes extra arguments for generating DOM trees... * When extra argument is an element reference, it''s appended to output * Extra string arguments become attribute/value of output. * [Exception] When the only extra argument is a string, it is appended as a textnode. (example 1) var x = $E(''p'',''this is a paragraph''); (example 2) var x = $E(''a'',''href'',''http:/\/cnn.com'',$T(''this is a link'')) What do you think and where do I post these; should I include them as an attachment here? - Best O''Luck! bemson ********************************************************************** Please be aware that, notwithstanding the fact that the person sending this communication has an address in Bear Stearns'' e-mail system, this person is not an employee, agent or representative of Bear Stearns. Accordingly, this person has no power or authority to represent, make any recommendation, solicitation, offer or statements or disclose information on behalf of or in any way bind Bear Stearns or any of its affiliates. **********************************************************************
I''m not questioning the usefullness of your functions, but there was already a discussion today regarding the use of $ functions and them polluting the namespace. I''m guessing the advice you''ll be given is to not use the shortcut methods (which I tend to agree with). On 4/27/06, Faison, Sandford (Exchange) <SFaison-7MaJjA0GXOY@public.gmane.org> wrote:> Hey all, > > I''ve had these functions for some time now, and would like to offer them > as two new dollar-sign functions - elements to be extended by Prototype > geniuses. :-) > > makeText(string) as $T() - return text node element > Does just what it says... I''m sure someone could extend it nicely when > via Prototype. > > (example) var x = $T(''hello world''); > > > xElement(tagname) as $E() - return DOM element > * return element, when tagname is a string - via ".createElement()" > * return (deep) clone, when tagname is already a DOM element > > $E processes extra arguments for generating DOM trees... > * When extra argument is an element reference, it''s appended to output > * Extra string arguments become attribute/value of output. > * [Exception] When the only extra argument is a string, it is appended > as a textnode. > > (example 1) var x = $E(''p'',''this is a paragraph''); > (example 2) var x = $E(''a'',''href'',''http:/\/cnn.com'',$T(''this is a > link'')) > > What do you think and where do I post these; should I include them as an > attachment here? > > - Best O''Luck! > > bemson > > > > ********************************************************************** > Please be aware that, notwithstanding the fact that the person sending > this communication has an address in Bear Stearns'' e-mail system, this > person is not an employee, agent or representative of Bear Stearns. > Accordingly, this person has no power or authority to represent, make > any recommendation, solicitation, offer or statements or disclose > information on behalf of or in any way bind Bear Stearns or any of its > affiliates. > ********************************************************************** > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >
Did you have a look on the script.aculo.us builder...? http://wiki.script.aculo.us/scriptaculous/show/Builder -Thomas Am 28.04.2006 um 00:34 schrieb Faison, Sandford (Exchange):> Hey all, > > I''ve had these functions for some time now, and would like to offer > them > as two new dollar-sign functions - elements to be extended by > Prototype > geniuses. :-) > > makeText(string) as $T() - return text node element > Does just what it says... I''m sure someone could extend it nicely when > via Prototype. > > (example) var x = $T(''hello world''); > > > xElement(tagname) as $E() - return DOM element > * return element, when tagname is a string - via ".createElement()" > * return (deep) clone, when tagname is already a DOM element > > $E processes extra arguments for generating DOM trees... > * When extra argument is an element reference, it''s appended to output > * Extra string arguments become attribute/value of output. > * [Exception] When the only extra argument is a string, it is appended > as a textnode. > > (example 1) var x = $E(''p'',''this is a paragraph''); > (example 2) var x = $E(''a'',''href'',''http:/\/cnn.com'',$T(''this is a > link'')) > > What do you think and where do I post these; should I include them > as an > attachment here? > > - Best O''Luck! > > bemson > > > > ********************************************************************** > Please be aware that, notwithstanding the fact that the person sending > this communication has an address in Bear Stearns'' e-mail system, this > person is not an employee, agent or representative of Bear Stearns. > Accordingly, this person has no power or authority to represent, make > any recommendation, solicitation, offer or statements or disclose > information on behalf of or in any way bind Bear Stearns or any of its > affiliates. > ********************************************************************** > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs-- Thomas Fuchs wollzelle http://www.wollzelle.com http://www.fluxiom.com :: online digital asset management http://script.aculo.us :: Web 2.0 JavaScript http://mir.aculo.us :: Where no web developer has gone before
Thanks Thomas, Didn''t even know this existed... I think mine has less "invocation-overhead"; you can list children and attribute information indiscriminately - neither needs to be inside an array or object literal. Overall, it''s a style issue, and scriptaculous wins that match every time. :-) Withstanding that, it''s nice to see this function exists in scriptaculous, if not prototype! - bemson -----Original Message----- From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Thomas Fuchs Sent: Friday, April 28, 2006 04:43 To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: Re: [Rails-spinoffs] proposing $E & $T Did you have a look on the script.aculo.us builder...? http://wiki.script.aculo.us/scriptaculous/show/Builder -Thomas Am 28.04.2006 um 00:34 schrieb Faison, Sandford (Exchange):> Hey all, > > I''ve had these functions for some time now, and would like to offer > them > as two new dollar-sign functions - elements to be extended by > Prototype > geniuses. :-) > > makeText(string) as $T() - return text node element > Does just what it says... I''m sure someone could extend it nicely when > via Prototype. > > (example) var x = $T(''hello world''); > > > xElement(tagname) as $E() - return DOM element > * return element, when tagname is a string - via ".createElement()" > * return (deep) clone, when tagname is already a DOM element > > $E processes extra arguments for generating DOM trees... > * When extra argument is an element reference, it''s appended to output > * Extra string arguments become attribute/value of output. > * [Exception] When the only extra argument is a string, it is appended > as a textnode. > > (example 1) var x = $E(''p'',''this is a paragraph''); > (example 2) var x = $E(''a'',''href'',''http:/\/cnn.com'',$T(''this is a > link'')) > > What do you think and where do I post these; should I include them > as an > attachment here? > > - Best O''Luck! > > bemson > > > > ********************************************************************** > Please be aware that, notwithstanding the fact that the person sending > this communication has an address in Bear Stearns'' e-mail system, this > person is not an employee, agent or representative of Bear Stearns. > Accordingly, this person has no power or authority to represent, make > any recommendation, solicitation, offer or statements or disclose > information on behalf of or in any way bind Bear Stearns or any of its > affiliates. > ********************************************************************** > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs-- Thomas Fuchs wollzelle http://www.wollzelle.com http://www.fluxiom.com :: online digital asset management http://script.aculo.us :: Web 2.0 JavaScript http://mir.aculo.us :: Where no web developer has gone before _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs ********************************************************************** Please be aware that, notwithstanding the fact that the person sending this communication has an address in Bear Stearns'' e-mail system, this person is not an employee, agent or representative of Bear Stearns. Accordingly, this person has no power or authority to represent, make any recommendation, solicitation, offer or statements or disclose information on behalf of or in any way bind Bear Stearns or any of its affiliates. **********************************************************************
yeah i don''t follow how usefull the $T() would be. i mean your example is.. (example) var x = $T(''hello world''); isn''t it just as simple to do this.. var x = ''hello world''; -jaimz Faison, Sandford (Exchange) wrote:> Hey all, > > I''ve had these functions for some time now, and would like to offer them > as two new dollar-sign functions - elements to be extended by Prototype > geniuses. :-) > > makeText(string) as $T() - return text node element > Does just what it says... I''m sure someone could extend it nicely when > via Prototype. > > (example) var x = $T(''hello world''); > > > xElement(tagname) as $E() - return DOM element > * return element, when tagname is a string - via ".createElement()" > * return (deep) clone, when tagname is already a DOM element > > $E processes extra arguments for generating DOM trees... > * When extra argument is an element reference, it''s appended to output > * Extra string arguments become attribute/value of output. > * [Exception] When the only extra argument is a string, it is appended > as a textnode. > > (example 1) var x = $E(''p'',''this is a paragraph''); > (example 2) var x = $E(''a'',''href'',''http:/\/cnn.com'',$T(''this is a > link'')) > > What do you think and where do I post these; should I include them as an > attachment here? > > - Best O''Luck! > > bemson > > > > ********************************************************************** > Please be aware that, notwithstanding the fact that the person sending > this communication has an address in Bear Stearns'' e-mail system, this > person is not an employee, agent or representative of Bear Stearns. > Accordingly, this person has no power or authority to represent, make > any recommendation, solicitation, offer or statements or disclose > information on behalf of or in any way bind Bear Stearns or any of its > affiliates. > ********************************************************************** > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > >
Jaimz, sounds to me more like $T(''hello world'') == document.createTextNode(''hello world''); On 5/5/06, Jaimz <jaimz-uIlgR+TDBxns2ve5o0e2fw@public.gmane.org> wrote:> yeah i don''t follow how usefull the $T() would be. i mean your example is.. > > (example) var x = $T(''hello world''); > > isn''t it just as simple to do this.. > > var x = ''hello world''; > > -jaimz > > > Faison, Sandford (Exchange) wrote: > > Hey all, > > > > I''ve had these functions for some time now, and would like to offer them > > as two new dollar-sign functions - elements to be extended by Prototype > > geniuses. :-) > > > > makeText(string) as $T() - return text node element > > Does just what it says... I''m sure someone could extend it nicely when > > via Prototype. > > > > (example) var x = $T(''hello world''); > > > > > > xElement(tagname) as $E() - return DOM element > > * return element, when tagname is a string - via ".createElement()" > > * return (deep) clone, when tagname is already a DOM element > > > > $E processes extra arguments for generating DOM trees... > > * When extra argument is an element reference, it''s appended to output > > * Extra string arguments become attribute/value of output. > > * [Exception] When the only extra argument is a string, it is appended > > as a textnode. > > > > (example 1) var x = $E(''p'',''this is a paragraph''); > > (example 2) var x = $E(''a'',''href'',''http:/\/cnn.com'',$T(''this is a > > link'')) > > > > What do you think and where do I post these; should I include them as an > > attachment here? > > > > - Best O''Luck! > > > > bemson > > > > > > > > ********************************************************************** > > Please be aware that, notwithstanding the fact that the person sending > > this communication has an address in Bear Stearns'' e-mail system, this > > person is not an employee, agent or representative of Bear Stearns. > > Accordingly, this person has no power or authority to represent, make > > any recommendation, solicitation, offer or statements or disclose > > information on behalf of or in any way bind Bear Stearns or any of its > > affiliates. > > ********************************************************************** > > _______________________________________________ > > Rails-spinoffs mailing list > > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > > > > > > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >