Thanks for the clarification. I understand the problem better now.Hopefully
there will be a solution.

Thanks a lot :)

2009/6/22 Fábio Costa <[email protected]>

> AFAIK, element.property = function(){} is done in IE. On firefox and others
> the new property is added to the prototype of the Class. Thats why when you
> get the XML it comes 'extended' with the mootools methods.
>
> on jQuery the $() function doesnt return a real element node, it returns a
> jQuery object, that has the jQuery functions.
>
> Its a bad problem for Mootools, and i see no good way to solve it, but
> there might be a good way, without having to transform the xml in html,
> whish is buggy for IE.
>
>
> Fábio Miranda Costa
> Engenheiro de Computação
> http://meiocodigo.com
>
>
> On Mon, Jun 22, 2009 at 1:37 AM, Eneko Alonso <[email protected]>wrote:
>
>> Hi Fabio,
>> From what I know, you can't add properties to any node (XML or DOM) on IE
>> browsers. For example, you can't do var x = document.getElementById('x');
>> x.y = function() {}; x = document.getElementById('x'); z.y();
>>
>> As far as I know, that would work on Firefox, for example, but not on IE,
>> for sure. That's why we need to extend the objects every time we query them
>> (z = $('x')), right?
>>
>> What is weird is that the xml response from Request is already extended by
>> Mootools. This is, all methods like getElement are available on that object.
>> But for some reason it fails while transversing the xml tree (only on IE).
>> Maybe every node should be extended while is being tranversed? That would be
>> very slow, I guess.
>>
>> You can do jQuery('<xml><here/></xml>') and that parses the text and
>> enables the xml tree to be browsed. There is no way to do that in Mootools
>> that I know. The problem of using 'html', as csuwldcat posted, is that it
>> will fail with some node names like body, title, comment and other IE
>> reserved words. Also, it will fail if xml nodes have a prefix (like <x:y>)
>> if I'm not mistaken.
>>
>> Very tricky problem, I think.
>>
>>
>>
>> 2009/6/21 Fábio Costa <[email protected]>
>>
>> @csuwldcat
>>> your code works but it is buggy, some very strange bugs occur on ie while
>>> doing this.
>>>
>>> I see no option, i tryed to find stuff on the internet but found nothing.
>>> The best way to do these stuff is by using pure DOM traversing functions.
>>>
>>> The problem is that it is not possible to add properties to XML nodes on
>>> IE ($(xml) doesnt work, xml.func = function(){} doenst work, which is what
>>> mootools do).
>>>
>>>
>>> Fábio Miranda Costa
>>> Engenheiro de Computação
>>> http://meiocodigo.com
>>>
>>>
>>> On Fri, Jun 19, 2009 at 3:53 PM, csuwldcat <[email protected]> wrote:
>>>
>>>>
>>>> Hey guys try this:
>>>>
>>>> var destinationEl = new Element( 'div', { 'html':
>>>> responseXmlFromYourRequest } );
>>>> destinationEl.getElements( 'somethingInTheXML' ).each( function( el )
>>>> {
>>>>    console.log( #someEl );
>>>> } );
>>>>
>>>> On Jun 19, 4:39 am, Fábio Costa <[email protected]> wrote:
>>>> > Ill really take a deep look at this.
>>>> > Thanks.
>>>> >
>>>> > Fábio Miranda Costa
>>>> > Engenheiro de Computaçãohttp://meiocodigo.com
>>>> >
>>>> > On Thu, Jun 18, 2009 at 6:52 PM, Eneko Alonso <[email protected]
>>>> >wrote:
>>>> >
>>>> >
>>>> >
>>>> > > Yep, that does not work...
>>>> >
>>>> > > I've been looking at jQuery's source code but I can't find how do
>>>> they
>>>> > > hanlde the XML so well for all browsers.
>>>> > > Any ideas?
>>>> >
>>>> > > I've seen some code to create a Request.XML class that basically
>>>> converts
>>>> > > the xml onto a DOM tree, but that has a bunch of issues on IE
>>>> browsers too,
>>>> > > as we have talked before (for example, IE wont let you create an
>>>> <image>
>>>> > > node).
>>>> >
>>>> > > 2009/6/18 Fábio Costa <[email protected]>
>>>> >
>>>> > >> extending the xml doesnt work, right?i mean like:
>>>> >
>>>> > >> $(xml).getElements........
>>>> >
>>>> > >> Fábio Miranda Costa
>>>> > >> Engenheiro de Computação
>>>> > >>http://meiocodigo.com
>>>> >
>>>> > >> 2009/6/18 Fábio Costa <[email protected]>
>>>> >
>>>> > >>> Eneko thats a serious issue, im sure core devs are with an eye on
>>>> it.But
>>>> > >>> i *think *it only come for the 2.0 series.
>>>> >
>>>> > >>> Fábio Miranda Costa
>>>> > >>> Engenheiro de Computação
>>>> > >>>http://meiocodigo.com
>>>> >
>>>> > >>> On Thu, Jun 18, 2009 at 1:16 PM, Eneko Alonso <
>>>> [email protected]>wrote:
>>>> >
>>>> > >>>> The request response is plain xml with no comments.Mootools
>>>> getElement
>>>> > >>>> function does not work on IE browsers, I can't remember the JS
>>>> error right
>>>> > >>>> now.
>>>> >
>>>> > >>>> I'm trying to create an example, but I can't find how to parse an
>>>> xml
>>>> > >>>> string into an xml document in mootools. Any ideas?
>>>> > >>>> var xml =
>>>> > >>>>
>>>> "<root><node>node1</node><node>node2</node><node>node3</node></root>";
>>>> > >>>> $(xml) returns null (I expected that but... had to try)
>>>> >
>>>> > >>>> 2009/6/18 Fábio Costa <[email protected]>
>>>> >
>>>> > >>>> Do you get any errors?Thanks for this report.
>>>> >
>>>> > >>>>> Fábio Miranda Costa
>>>> > >>>>> Engenheiro de Computação
>>>> > >>>>>http://meiocodigo.com
>>>> >
>>>> > >>>>> On Thu, Jun 18, 2009 at 8:58 AM, bluff <
>>>> [email protected]>wrote:
>>>> >
>>>> > >>>>>> Are the comments in the request reply. if so IE cannot handle
>>>> this and
>>>> > >>>>>> will always fail.
>>>> > >>>>>> Solution remove the comments from the request reply
>>>> >
>>>> > >>>>>> On Jun 17, 11:56 pm, Eneko Alonso <[email protected]>
>>>> wrote:
>>>> > >>>>>> > I sent an email a copule of weeks ago about an issue parsing
>>>> XML
>>>> > >>>>>> withg
>>>> > >>>>>> > Mootools on IE browsers, something that jQuery does fine, as
>>>> you can
>>>> > >>>>>> see on
>>>> > >>>>>> > the next example.Notice the ajax request is done in Mootools,
>>>> even
>>>> > >>>>>> when the
>>>> > >>>>>> > xml is parsed by jQuery.
>>>> >
>>>> > >>>>>> > On this project I have both Mootools and jQuery, so I'm fine,
>>>> but
>>>> > >>>>>> what if I
>>>> > >>>>>> > had only Mootools?
>>>> >
>>>> > >>>>>> >         this.request = new Request({
>>>> > >>>>>> >             method: 'get',
>>>> > >>>>>> >             url: this.gallery.photosFeed + '&' +
>>>> > >>>>>> Hash.toQueryString({start:
>>>> > >>>>>> > 0, end: 10}),
>>>> >
>>>> > >>>>>> >             onSuccess: function(text, xml) {
>>>> > >>>>>> >                 if (!$defined(xml)) {
>>>> > >>>>>> >                     console.warn('Gallery XML is empty.')
>>>> > >>>>>> >                     return;
>>>> > >>>>>> >                 }
>>>> >
>>>> > >>>>>> >                 // *** MOOTOOLS CODE FAILS ON IE BROWSERS ***
>>>> > >>>>>> >                 //
>>>> xml.getElements('document').each(function(photo,
>>>> > >>>>>> index) {
>>>> > >>>>>> >                 //     var pic = {
>>>> > >>>>>> >                 //         docId:
>>>> > >>>>>> >     photo.getElement('fileentryid').get('text'),
>>>> > >>>>>> >                 //         userId:
>>>> > >>>>>> >    photo.getElement('userid').get('text'),
>>>> > >>>>>> >                 //         title:
>>>> > >>>>>> photo.getElement('title').get('text'),
>>>> > >>>>>> >                 //         ownerName:
>>>> > >>>>>> > photo.getElement('userfullname').get('text'),
>>>> > >>>>>> >                 //         rating:
>>>> > >>>>>> >    photo.getElement('rating').get('text').toFloat(),
>>>> > >>>>>> >                 //         created:   new
>>>> > >>>>>> > Date(photo.getElement('createdate').get('text') * 1000),
>>>> > >>>>>> >                 //         images:   {}
>>>> > >>>>>> >                 //     }
>>>> > >>>>>> >                 //
>>>> > >>>>>> photo.getElements('image').each(function(image) {
>>>> > >>>>>> >                 //         pic.images[image.get('label')] =
>>>> > >>>>>> > image.getElement('url').get('text')
>>>> > >>>>>> >                 //     });
>>>> > >>>>>> >                 //     var photoThumb = new PhotoThumb({data:
>>>> pic});
>>>> > >>>>>> >                 //     this.gallery.photos.push(photoThumb);
>>>> > >>>>>> >                 //
>>>> this.photosList.grab(photoThumb.element);
>>>> > >>>>>> >                 // }.bind(this));
>>>> >
>>>> > >>>>>> >
>>>> jQuery(xml).find('document').each(function(index,
>>>> > >>>>>> photo) {
>>>> > >>>>>> >                     photo = jQuery(photo);
>>>> > >>>>>> >                     var pic = {
>>>> > >>>>>> >                         docId:
>>>> photo.find('fileentryid').text(),
>>>> > >>>>>> >                         userId:
>>>>  photo.find('userid').text(),
>>>> > >>>>>> >                         title:
>>>> photo.find('title').text(),
>>>> > >>>>>> >                         ownerName:
>>>> > >>>>>> photo.find('userfullname').text(),
>>>> > >>>>>> >                         rating:
>>>> > >>>>>>  photo.find('rating').text().toFloat(),
>>>> > >>>>>> >                         created:   new
>>>> > >>>>>> Date(photo.find('createdate').text()
>>>> > >>>>>> > * 1000),
>>>> > >>>>>> >                         images:   {}
>>>> > >>>>>> >                     }
>>>> > >>>>>> >                     var images = photo.find('image');
>>>> > >>>>>> >                     images.each(function() {
>>>> > >>>>>> >                         var image = jQuery(this);
>>>> > >>>>>> >                         pic.images[image.attr('label')] =
>>>> > >>>>>> > image.find('url').text();
>>>> > >>>>>> >                     });
>>>> >
>>>> > >>>>>> >                     // This code does not change from avobe
>>>> > >>>>>> >                     var photoThumb = new PhotoThumb({data:
>>>> pic});
>>>> > >>>>>> >                     this.gallery.photos.push(photoThumb);
>>>> > >>>>>> >                     this.photosList.grab(photoThumb.element);
>>>> > >>>>>> >                 }.bind(this));
>>>> > >>>>>> >             }.bind(this),
>>>> >
>>>> > >>>>>> >             onFailure: function() {
>>>> > >>>>>> >                 console.warn('Gallery feed could not be
>>>> loaded.');
>>>> > >>>>>> >             }
>>>> > >>>>>> >         });
>>>> > >>>>>> >         this.request.send();
>>>>
>>>
>>>
>>
>

Reply via email to