Because of toElement conflict we had to use makeElement in Prototype-
UI. Take a look at the source if you're interested.
http://dev.prototype-ui.com/browse/trunk/src/core/string.js

 - kangax

On Mar 24, 8:40 am, Станислав Анисимов <[EMAIL PROTECTED]>
wrote:
> If you think that the functionalities can be useful they can be added
> to Element object like
> Element.replaceClassNames
> Element.cycleClassNames
>
> On Mar 24, 3:23 pm, Tobie Langel <[EMAIL PROTECTED]> wrote:
>
> > Hi Станислав Анисимов,
>
> > Element.ClassNames is deprecated.
>
> > Best,
>
> > Tobie
>
> > On Mar 24, 1:11 pm, Станислав Анисимов <[EMAIL PROTECTED]>
> > wrote:
>
> > > Pair of functionalities to String object. Actully i found that
> > > String.toElement method conflicts with Element.update or may be also
> > > with some other functions
>
> > > Object.extend(String.prototype, {
>
> > >         /**
> > >          * If the string is html code and enclosed with html element 
> > > convert
> > > to Element
> > >          * else the string is wraped with <span> or with 1st argument tag
> > >          *
> > >          * return {Element}
> > >          */
> > >         toElement: function() {
> > >                 str = this.strip();
> > >                 if (!str.startsWith('<') || !str.endsWith('>')){
> > >                         wrapTag = arguments[0]||'span';
> > >                         str = '<' + wrapTag + '>' + str + '</' + wrapTag 
> > > + '>';
> > >                 }
>
> > >                 var node = new Element('span');
> > >                 node.innerHTML = str;
> > >                 if (node.childElements().length == 1) {
> > >                         return node.down();
> > >                 }
> > >                 return node;
> > >         },
>
> > >         /**
> > >          * Extract elements from HTML code with given selector
> > >          *
> > >          * @param {String} selector
> > >          * @return {Array} Array of elements
> > >          */
> > >         extractElements: function(selector) {
> > >                 return this.toElement().select(selector);
> > >         }
>
> > > })
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to