Quantcast

[Moo] Conflict between MS Ajax and MooTools...

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Moo] Conflict between MS Ajax and MooTools...

codeBender

First, let me say thanks to everyone who works on this awesome
library. It's very handy indeed and I certainly appreciate the hard
work that has gone into it.

I have a few questions/issues:

1. MooTools is causing a runtime exception in the MS Ajax script
library.

This JS runtime exception occurs anytime I click anywhere on the page.
I have been debugging this thing all morning and haven't made much
progress.

// Name:        MicrosoftAjaxWebForms.debug.js
// Assembly:    System.Web.Extensions

Line: 722
Error: Object doesn't support this property or method

Here's the JS code from that section:

function Sys$WebForms$PageRequestManager$_matchesParentIDInList
(clientID, parentIDList) {
    for (var i = 0, l = parentIDList.length; i < l; i++) {
        if (clientID.startsWith(parentIDList[i] + "_")) {
            return true;
        }
    }
    return false;
}

If I remove the MooTools script reference from my page, the error
stops occurring.


2. Is there a way to set a background image using the Fx.start method?
So I'd like to do something like this: myFx.start('background-image',
'<insert path to image>');


3. Is there a scaled down version of MooTools broken up into
subscripts? I'd like to only import the classes and methods required
to use the tween methods instead of the entire library.

Thanks...









Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Moo] Re: Conflict between MS Ajax and MooTools...

Ryan Florence

3.  Go to mootools.net/download - you can do click "Tween" and it will  
check only the required files.  There's your custom download.

2. I don't think so.  You can only tween stuff that has some  
mathematical logic, like borders, colors, dimensions, etc.  What would  
you expect to happen when you "tween" a background image?  Fade?

1.  I have no idea.  Anything that starts with MS gives me errors in  
my soul.

On Aug 3, 2009, at 11:45 AM, codeBender wrote:

>
> First, let me say thanks to everyone who works on this awesome
> library. It's very handy indeed and I certainly appreciate the hard
> work that has gone into it.
>
> I have a few questions/issues:
>
> 1. MooTools is causing a runtime exception in the MS Ajax script
> library.
>
> This JS runtime exception occurs anytime I click anywhere on the page.
> I have been debugging this thing all morning and haven't made much
> progress.
>
> // Name:        MicrosoftAjaxWebForms.debug.js
> // Assembly:    System.Web.Extensions
>
> Line: 722
> Error: Object doesn't support this property or method
>
> Here's the JS code from that section:
>
> function Sys$WebForms$PageRequestManager$_matchesParentIDInList
> (clientID, parentIDList) {
>    for (var i = 0, l = parentIDList.length; i < l; i++) {
>        if (clientID.startsWith(parentIDList[i] + "_")) {
>            return true;
>        }
>    }
>    return false;
> }
>
> If I remove the MooTools script reference from my page, the error
> stops occurring.
>
>
> 2. Is there a way to set a background image using the Fx.start method?
> So I'd like to do something like this: myFx.start('background-image',
> '<insert path to image>');
>
>
> 3. Is there a scaled down version of MooTools broken up into
> subscripts? I'd like to only import the classes and methods required
> to use the tween methods instead of the entire library.
>
> Thanks...
>
>
>
>
>
>
>
>
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Moo] Re: Conflict between MS Ajax and MooTools...

nwhite-2

2. I don't think so.  You can only tween stuff that has some mathematical logic, like borders, colors, dimensions, etc.  What would you expect to happen when you "tween" a background image?  Fade?


yeah you couldn't do background-image, but background-position is possible.

 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Moo] Re: Conflict between MS Ajax and MooTools...

codeBender


> yeah you couldn't do background-image, but background-position is possible.

Thanks for both replies. That makes sense. Looking back on what I was
trying to accomplish last week, I'm not entirely sure what I was
thinking. The UI I'm working on has several hidden form componenets
that are loded on demand using Ajax calls. To get to these areas, the
user would have to click a row in a grid that will then animate
expanding a panel beneath it. The backgroud image I was using was
repeating accross the panel, so I just used background-repeat:repeat-
x; to solve the issue. I'm not entirely sure why I didn't think of
that earlier. Lack of sleep perhaps.

As to the MS error, it's frustrating. I have to make a choice now,
scrap MooTools or scrap MS Ajax. If I scarp MooTools it will mean
writing my own tween fuctionality, which isn't that big of deal except
I'm on a deadline and don't really have the extra time. I'm using an
alternative Ajax library as well, so it's possible I might be able to
scrap MS Ajax. The amount of work for both is about the same. I
suppose getting rid of the MS library might make the most sense
because it's SO bloated. Alas, I'm sure I'll figure out something.
Thanks again for the help.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Moo] Re: Conflict between MS Ajax and MooTools...

anutron
Have you tried using the MSFT script debugger on the code error? The error:

Line: 722
Error: Object doesn't support this property or method

is IE's usual useless stuff, and I wouldn't trust that line number. I bet that the code you've supplied may not even be the problem. Install the script debugger and see if it gives you more useful info.

On Mon, Aug 3, 2009 at 11:48 AM, codeBender <[hidden email]> wrote:


> yeah you couldn't do background-image, but background-position is possible.

Thanks for both replies. That makes sense. Looking back on what I was
trying to accomplish last week, I'm not entirely sure what I was
thinking. The UI I'm working on has several hidden form componenets
that are loded on demand using Ajax calls. To get to these areas, the
user would have to click a row in a grid that will then animate
expanding a panel beneath it. The backgroud image I was using was
repeating accross the panel, so I just used background-repeat:repeat-
x; to solve the issue. I'm not entirely sure why I didn't think of
that earlier. Lack of sleep perhaps.

As to the MS error, it's frustrating. I have to make a choice now,
scrap MooTools or scrap MS Ajax. If I scarp MooTools it will mean
writing my own tween fuctionality, which isn't that big of deal except
I'm on a deadline and don't really have the extra time. I'm using an
alternative Ajax library as well, so it's possible I might be able to
scrap MS Ajax. The amount of work for both is about the same. I
suppose getting rid of the MS library might make the most sense
because it's SO bloated. Alas, I'm sure I'll figure out something.
Thanks again for the help.

The MooTools Tutorial: www.mootorial.com Clientcide: www.clientcide.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Moo] Re: Conflict between MS Ajax and MooTools...

nwhite-2
In reply to this post by codeBender
if your able to post a test page with the code stubs so it generates the error, it would be easier for others how to advise you on your possible solutions.

I suspect the culprit is for( in ){ ... } statements within the MS code. If these are being used on arrays then yes, you would get that error message.

Nathan

On Mon, Aug 3, 2009 at 11:48 AM, codeBender <[hidden email]> wrote:


> yeah you couldn't do background-image, but background-position is possible.

Thanks for both replies. That makes sense. Looking back on what I was
trying to accomplish last week, I'm not entirely sure what I was
thinking. The UI I'm working on has several hidden form componenets
that are loded on demand using Ajax calls. To get to these areas, the
user would have to click a row in a grid that will then animate
expanding a panel beneath it. The backgroud image I was using was
repeating accross the panel, so I just used background-repeat:repeat-
x; to solve the issue. I'm not entirely sure why I didn't think of
that earlier. Lack of sleep perhaps.

As to the MS error, it's frustrating. I have to make a choice now,
scrap MooTools or scrap MS Ajax. If I scarp MooTools it will mean
writing my own tween fuctionality, which isn't that big of deal except
I'm on a deadline and don't really have the extra time. I'm using an
alternative Ajax library as well, so it's possible I might be able to
scrap MS Ajax. The amount of work for both is about the same. I
suppose getting rid of the MS library might make the most sense
because it's SO bloated. Alas, I'm sure I'll figure out something.
Thanks again for the help.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Moo] Re: Conflict between MS Ajax and MooTools...

Fabio M. Costa
In reply to this post by codeBender
are you using 1.2.3?
i thought this had been fixed.

--
Fábio Miranda Costa
Solucione Sistemas
Front-End Engineer
http://meiocodigo.com


On Mon, Aug 3, 2009 at 3:48 PM, codeBender <[hidden email]> wrote:


> yeah you couldn't do background-image, but background-position is possible.

Thanks for both replies. That makes sense. Looking back on what I was
trying to accomplish last week, I'm not entirely sure what I was
thinking. The UI I'm working on has several hidden form componenets
that are loded on demand using Ajax calls. To get to these areas, the
user would have to click a row in a grid that will then animate
expanding a panel beneath it. The backgroud image I was using was
repeating accross the panel, so I just used background-repeat:repeat-
x; to solve the issue. I'm not entirely sure why I didn't think of
that earlier. Lack of sleep perhaps.

As to the MS error, it's frustrating. I have to make a choice now,
scrap MooTools or scrap MS Ajax. If I scarp MooTools it will mean
writing my own tween fuctionality, which isn't that big of deal except
I'm on a deadline and don't really have the extra time. I'm using an
alternative Ajax library as well, so it's possible I might be able to
scrap MS Ajax. The amount of work for both is about the same. I
suppose getting rid of the MS library might make the most sense
because it's SO bloated. Alas, I'm sure I'll figure out something.
Thanks again for the help.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Moo] Re: Conflict between MS Ajax and MooTools...

mingqlin
This post has NOT been accepted by the mailing list yet.
I also has exactly same issue. and I am using Mootools 1.2.3 the latest version on the web. and receive the same error message, for only the pages has ScriptManager (MS Ajax). Do anyone has a solution?

Fábio M. Costa wrote
are you using 1.2.3?
i thought this had been fixed.

--
Fábio Miranda Costa
Solucione Sistemas
Front-End Engineer
http://meiocodigo.com


On Mon, Aug 3, 2009 at 3:48 PM, codeBender <andrew.green10@gmail.com> wrote:

>
>
> > yeah you couldn't do background-image, but background-position is
> possible.
>
> Thanks for both replies. That makes sense. Looking back on what I was
> trying to accomplish last week, I'm not entirely sure what I was
> thinking. The UI I'm working on has several hidden form componenets
> that are loded on demand using Ajax calls. To get to these areas, the
> user would have to click a row in a grid that will then animate
> expanding a panel beneath it. The backgroud image I was using was
> repeating accross the panel, so I just used background-repeat:repeat-
> x; to solve the issue. I'm not entirely sure why I didn't think of
> that earlier. Lack of sleep perhaps.
>
> As to the MS error, it's frustrating. I have to make a choice now,
> scrap MooTools or scrap MS Ajax. If I scarp MooTools it will mean
> writing my own tween fuctionality, which isn't that big of deal except
> I'm on a deadline and don't really have the extra time. I'm using an
> alternative Ajax library as well, so it's possible I might be able to
> scrap MS Ajax. The amount of work for both is about the same. I
> suppose getting rid of the MS library might make the most sense
> because it's SO bloated. Alas, I'm sure I'll figure out something.
> Thanks again for the help.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Moo] Conflict between MS Ajax and MooTools...

.netnazi
In reply to this post by codeBender
codebender...
I just ran into this issue today (well i saw it happening but ignored it for a little while but decided to look into it today).
The reason this is occurring is because in the mootools framework(core) it defines it defines a function off of document called id.. open up your core file and search for "id:(function()" you will notice that it is grouped by several other handy sounding functions.. it just a shortcut to document.getElementById..
So why does .net get tangled up in this? because when a click event occurs anywhere on the page, .net is enumerating elements looking for particular ones in a list it keeps... and it looks at element.id (as you would expect to look for an id of an element) and then calling the string function startsWith to match values in its list. .net does this for postback information.. not sure exactly but probably something to do with validation.
So what do you do? I have a somewhat "modified" version of mootools.. which makes it more difficult to upgrade to more recent versions.. so I just renamed the function id to byid and did a !!CAREFUL!! search and replace throughout the mootools lib and plugins.. And then added a note with the rest of the notes about the changes I made to the top of my mootools Core lib.

I don't know if this is something that you would want to do.. I'm sure a lot of people would scoff at what I have done, but it works for me. And until mootools does something about this - that's the way it going to be.

Hope this helps
jared

codeBender wrote
First, let me say thanks to everyone who works on this awesome
library. It's very handy indeed and I certainly appreciate the hard
work that has gone into it.

I have a few questions/issues:

1. MooTools is causing a runtime exception in the MS Ajax script
library.

This JS runtime exception occurs anytime I click anywhere on the page.
I have been debugging this thing all morning and haven't made much
progress.

// Name:        MicrosoftAjaxWebForms.debug.js
// Assembly:    System.Web.Extensions

Line: 722
Error: Object doesn't support this property or method

Here's the JS code from that section:

function Sys$WebForms$PageRequestManager$_matchesParentIDInList
(clientID, parentIDList) {
    for (var i = 0, l = parentIDList.length; i < l; i++) {
        if (clientID.startsWith(parentIDList[i] + "_")) {
            return true;
        }
    }
    return false;
}

If I remove the MooTools script reference from my page, the error
stops occurring.


2. Is there a way to set a background image using the Fx.start method?
So I'd like to do something like this: myFx.start('background-image',
'<insert path to image>');


3. Is there a scaled down version of MooTools broken up into
subscripts? I'd like to only import the classes and methods required
to use the tween methods instead of the entire library.

Thanks...








Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Moo] Conflict between MS Ajax and MooTools...

Sanford Whiteman [Mobile]
> The reason this is occurring is because in the mootools framework(core) it
> defines it defines a function off of document called id.. open up your core
> file and search for "id:(function()" you will notice that it is grouped by
> several other handy sounding functions.. it just a shortcut to
> document.getElementById..

Surely anyone who uses the latest Moo knows about this function.

http://mootools.net/blog/2009/06/22/the-dollar-safe-mode/

> So why does .net get tangled up in this? because when a click event occurs
> anywhere on the page, .net is enumerating elements looking for particular
> ones in a list it keeps... and it looks at element.id (as you would expect
> to look for an id of an element)

document.id != Element.id

The bug is in Microsoft's code, where they frequently have a var named
`element`  actually be set to either an Element object or to document.
(While  document.documentElement  is an Element, document by itself is
not.) They are stupidly duck-typing `element`, relying on `element.id`
== undefined whenever element is really a document and thus gracefully
avoiding some code sections.

When  `element.id`  turns  out  to exist even when element = document,
they  have  a  problem.  They  wouldn't have this problem if they just
checked  the  type of `element`, which in turn would be easier if they
used a not-completely-misleading variable name.

> So what do you do?

Stop blaming MooTools and dare to report/bugfix the MS code instead?

-- Sandy

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Moo] Re: Conflict between MS Ajax and MooTools...

Darren Waddell
Just to say this has been filed in Lighthouse and I will look into it.
I disagree with Sandy that this is Microsoft's 'fault' - this is the
problem we are always open to when we extend native prototypes. I am a
lot of experience in C#/.NET programming so this is something I have a
vested interest in. I don't believe it to be an insurmountable
problem.

On Dec 19 2009, 7:17 am, Sanford Whiteman
<[hidden email]> wrote:

> > The reason this is occurring is because in the mootools framework(core) it
> > defines it defines a function off of document called id.. open up your core
> > file and search for "id:(function()" you will notice that it is grouped by
> > several other handy sounding functions.. it just a shortcut to
> > document.getElementById..
>
> Surely anyone who uses the latest Moo knows about this function.
>
> http://mootools.net/blog/2009/06/22/the-dollar-safe-mode/
>
> > So why does .net get tangled up in this? because when a click event occurs
> > anywhere on the page, .net is enumerating elements looking for particular
> > ones in a list it keeps... and it looks at element.id (as you would expect
> > to look for an id of an element)
>
> document.id != Element.id
>
> The bug is in Microsoft's code, where they frequently have a var named
> `element`  actually be set to either an Element object or to document.
> (While  document.documentElement  is an Element, document by itself is
> not.) They are stupidly duck-typing `element`, relying on `element.id`
> == undefined whenever element is really a document and thus gracefully
> avoiding some code sections.
>
> When  `element.id`  turns  out  to exist even when element = document,
> they  have  a  problem.  They  wouldn't have this problem if they just
> checked  the  type of `element`, which in turn would be easier if they
> used a not-completely-misleading variable name.
>
> > So what do you do?
>
> Stop blaming MooTools and dare to report/bugfix theMScode instead?
>
> -- Sandy
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Moo] Conflict between MS Ajax and MooTools...

subtleGradient
In reply to this post by codeBender
Try this as a quick fix/workaround:
http://gist.github.com/269990

Basically it appears as if `clientID` is a function and not a string.
So it doesn't have the `startsWith` method and therefore breaks.
This workaround simple adds the method they expect to find.
This workaround shouldn't effect anything else. This function sitting
there is perfectly harmless.

Let me know if this does or doesn't solve your issue.

Thanks.

— Thomas Aylott
    SubtleGradient
    MooTools



On Mon, Aug 3, 2009 at 12:45 PM, codeBender <[hidden email]> wrote:

>
> First, let me say thanks to everyone who works on this awesome
> library. It's very handy indeed and I certainly appreciate the hard
> work that has gone into it.
>
> I have a few questions/issues:
>
> 1. MooTools is causing a runtime exception in the MS Ajax script
> library.
>
> This JS runtime exception occurs anytime I click anywhere on the page.
> I have been debugging this thing all morning and haven't made much
> progress.
>
> // Name:        MicrosoftAjaxWebForms.debug.js
> // Assembly:    System.Web.Extensions
>
> Line: 722
> Error: Object doesn't support this property or method
>
> Here's the JS code from that section:
>
> function Sys$WebForms$PageRequestManager$_matchesParentIDInList
> (clientID, parentIDList) {
>    for (var i = 0, l = parentIDList.length; i < l; i++) {
>        if (clientID.startsWith(parentIDList[i] + "_")) {
>            return true;
>        }
>    }
>    return false;
> }
>
> If I remove the MooTools script reference from my page, the error
> stops occurring.
>
>
> 2. Is there a way to set a background image using the Fx.start method?
> So I'd like to do something like this: myFx.start('background-image',
> '<insert path to image>');
>
>
> 3. Is there a scaled down version of MooTools broken up into
> subscripts? I'd like to only import the classes and methods required
> to use the tween methods instead of the entire library.
>
> Thanks...
>
>
>
>
>
>
>
>
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Moo] Conflict between MS Ajax and MooTools...

subtleGradient
I added a detailed explanation of the original problem along with the
original source code here:
http://gist.github.com/269990#file_microsoft_ajax_web_forms.debug.js

There are essentially two issues.

1) Microsoft's client-side code is not written to be very defensive.
They use essentially `if (elementOrDocument.id)
elementOrDocument.id.stringMethod();` instead of `if (typeof
elementOrDocument.id == "string")
elementOrDocument.id.stringMethod();` or something like that.

2) MooTools creates an `id` method on the global document object
instead of on a unique namespace.

— Thomas Aylott
    SubtleGradient
    MooTools



On Tue, Jan 5, 2010 at 10:44 PM, Thomas Aylott
<[hidden email]> wrote:

> Try this as a quick fix/workaround:
> http://gist.github.com/269990
>
> Basically it appears as if `clientID` is a function and not a string.
> So it doesn't have the `startsWith` method and therefore breaks.
> This workaround simple adds the method they expect to find.
> This workaround shouldn't effect anything else. This function sitting
> there is perfectly harmless.
>
> Let me know if this does or doesn't solve your issue.
>
> Thanks.
>
> — Thomas Aylott
>    SubtleGradient
>    MooTools
>
>
>
> On Mon, Aug 3, 2009 at 12:45 PM, codeBender <[hidden email]> wrote:
>>
>> First, let me say thanks to everyone who works on this awesome
>> library. It's very handy indeed and I certainly appreciate the hard
>> work that has gone into it.
>>
>> I have a few questions/issues:
>>
>> 1. MooTools is causing a runtime exception in the MS Ajax script
>> library.
>>
>> This JS runtime exception occurs anytime I click anywhere on the page.
>> I have been debugging this thing all morning and haven't made much
>> progress.
>>
>> // Name:        MicrosoftAjaxWebForms.debug.js
>> // Assembly:    System.Web.Extensions
>>
>> Line: 722
>> Error: Object doesn't support this property or method
>>
>> Here's the JS code from that section:
>>
>> function Sys$WebForms$PageRequestManager$_matchesParentIDInList
>> (clientID, parentIDList) {
>>    for (var i = 0, l = parentIDList.length; i < l; i++) {
>>        if (clientID.startsWith(parentIDList[i] + "_")) {
>>            return true;
>>        }
>>    }
>>    return false;
>> }
>>
>> If I remove the MooTools script reference from my page, the error
>> stops occurring.
>>
>>
>> 2. Is there a way to set a background image using the Fx.start method?
>> So I'd like to do something like this: myFx.start('background-image',
>> '<insert path to image>');
>>
>>
>> 3. Is there a scaled down version of MooTools broken up into
>> subscripts? I'd like to only import the classes and methods required
>> to use the tween methods instead of the entire library.
>>
>> Thanks...
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Moo] Conflict between MS Ajax and MooTools...

Sanford Whiteman [Mobile]
An  experimental  tactic here, using custom getter. Would take care of
broader  MSAjax context, but is fated to be demonstration-only for now
because  there  are no getters in IE pre-8. Haven't timed it but there
is going to also be some overhead.

http://mootools.net/shell/gYSyV/3/

I  worked  on  this  for  quite a while tonight. I have no plan to use
MSAjax at any time but wanted to help Moo and MSAjax coexist for other
people. Please consider this before telling me to shut up.

-- Sandy

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Moo] Conflict between MS Ajax and MooTools...

maryamgoly.ap
This post has NOT been accepted by the mailing list yet.
In reply to this post by codeBender
Thanks SubtleGradient !
your solution solved my problem after 2 weeks passed by searching!
Really Thank U!
Loading...