473,699 Members | 2,190 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

AJAX.NET and prototype.js

I just noticed that prototype.js is one of the files in the Ajax.NET
distribution - I'm pretty concerned about this. Does anyone know if this
is the same "prototype. js" that is not well-liked around here?

If so, do you know if Ajax.NET can be used without prototype.js?
--
"The most convoluted explanation that fits all of the made-up facts is
the most likely to be believed by conspiracy theorists. Fitting the
actual facts is optional."
Jun 28 '06 #1
31 3138
Tony said the following on 6/28/2006 2:00 PM:
I just noticed that prototype.js is one of the files in the Ajax.NET
distribution - I'm pretty concerned about this. Does anyone know if this
is the same "prototype. js" that is not well-liked around here?
All it would take is to compare the file size and the first 10 lines or
so to see if they are the same.
If so, do you know if Ajax.NET can be used without prototype.js?


That would required testing it without prototype to see if it still
"works" or not.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Temporarily at: http://members.aol.com/_ht_a/hikksnotathome/cljfaq/
Javascript Best Practices -
Jun 28 '06 #2
Randy Webb wrote:
Tony said the following on 6/28/2006 2:00 PM:
I just noticed that prototype.js is one of the files in the Ajax.NET
distribution - I'm pretty concerned about this. Does anyone know if
this is the same "prototype. js" that is not well-liked around here?


All it would take is to compare the file size and the first 10 lines or
so to see if they are the same.
If so, do you know if Ajax.NET can be used without prototype.js?


That would required testing it without prototype to see if it still
"works" or not.


Obviously, I was hoping to hear from someone who had already been
through this experience :)
--
"The most convoluted explanation that fits all of the made-up facts is
the most likely to be believed by conspiracy theorists. Fitting the
actual facts is optional."
Jun 28 '06 #3
Tony wrote:
the same "prototype. js" that is not well-liked around here?


It's not well-liked? I think it can be really useful, as long as you
know what you're getting into when you use it and code accordingly.
IMHO, saying it's inherently bad is like saying the C++ STL is bad.
Sure, it's not part of the language per se, but if you want to make use
of the functionality it provides then what's the harm?

Just don't expect that any Prototype-independent libraries will still
work (although there are only a few problems that it causes - most
notably with for-in loops, which don't seem to be that widely used, and
in any case should never be used with any pre-assumptions about what
members they will discover).

Am I missing some big "gotcha" that's turned the community against this
library?

Jeremy
Jun 28 '06 #4
Jeremy wrote:
Tony wrote:
the same "prototype. js" that is not well-liked around here?
It's not well-liked?


Based on a number of posts I've read over the past month or so, yes.
I think it can be really useful, as long as you
know what you're getting into when you use it and code accordingly.
Perhaps, but that is a different discussion.
IMHO, saying it's inherently bad is like saying the C++ STL is bad.
I didn't say it was inherently bad. My question (that you didn't quote,
BTW) was if the Ajax.net one was the same one.
Sure, it's not part of the language per se, but if you want to make use
of the functionality it provides then what's the harm?
And if I DON'T want to make use of it?
Am I missing some big "gotcha" that's turned the community against this
library?


Take a look through this group's recent discussions on the matter, or
see http://www.javascripttoolbox.com/bes...ces/#prototype for a
quick summary.

So, are they the same?

--
"The most convoluted explanation that fits all of the made-up facts is
the most likely to be believed by conspiracy theorists. Fitting the
actual facts is optional."
Jun 28 '06 #5
Jeremy wrote:
Just don't expect that any Prototype-independent libraries will still
work (although there are only a few problems that it causes - most
notably with for-in loops, which don't seem to be that widely used,
and in any case should never be used with any pre-assumptions about
what members they will discover).
That is quite an assumption.

If I do:
var name = {'first':'bob'} ;

and then cycle through its properties, I expect to see 'first' and only
'first'. Otherwise, using an Object as a "Hash Table" isn't possible.
Am I missing some big "gotcha" that's turned the community against
this library?


http://www.javascripttoolbox.com/bes...ces/#prototype

--
Matt Kruse
http://www.JavascriptToolbox.com
http://www.AjaxToolbox.com
Jun 28 '06 #6
Matt Kruse wrote:

If I do:
var name = {'first':'bob'} ;

and then cycle through its properties, I expect to see 'first' and only
'first'. Otherwise, using an Object as a "Hash Table" isn't possible.

So why not use an Array as a "Hash Table"? Is that not what it's for?
Note: I'm not trying to be a jerk or come off as dense; I'm genuinely
interested. Does the ECMAScript specification require that an object
not have inherent properties, or that these properties not show up in a
for..in loop? The specification is pretty lax on that, and I would
argue that you shouldn't be relying on those assumptions in order for
your program to work.

Incidentally, it seems like this particular problem ought to be fixable
by setting the DontEnum attribute of the methods and properties that
prototype.js adds to Object. But I really have no idea if this is
implemented in user-agents; I'm sure someone would have implemented into
the library if it were feasible.

http://www.javascripttoolbox.com/bes...ces/#prototype


An interesting quote from your link:
"If you are writing code which only uses Prototype and nothing else,
then it can make your life simpler in often ingenious ways."

I'm not necessarily trying to argue that it's wise to use prototype.js -
I'm just arguing that the problems it causes are ALSO a symptom of
assumptions made by the people who diss it.

Jeremy
Jun 28 '06 #7
> Take a look through this group's recent discussions on the matter, or
see http://www.javascripttoolbox.com/bes...ces/#prototype for a
quick summary.


The fact that carelessly throwing in an otherwise useful script
framework might cause problems does not at all mean "the community is
against" it. Most people who use prototype improperly are probably
novices, and thus not active in "the community".

In my use, prototype has been very useful, and I also enjoy using the
effects libraries (e.g. rico) that are built on top of it.

Jun 28 '06 #8
Hi,

Jeremy wrote:
So why not use an Array as a "Hash Table"?


JavaScript allows to add properties dynamically to any object type. You
could even use an Image if you want. However, Array and other types have
already defined properties (Array.length, for example), which will
appear when you do a for...in. Additionally, in the case of a
"hashtable" , these properties are unused, and disturb more than they
help. This is why it's better to use Object for a "hashtable" (but then
again, if someone external added properties to the Object prototype,
then you got the same problem, QED)

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
Jun 28 '06 #9
Jeremy wrote:
Matt Kruse wrote:
If I do:
var name = {'first':'bob'} ;

and then cycle through its properties, I expect to
see 'first' and only 'first'. Otherwise, using an
Object as a "Hash Table" isn't possible.
So why not use an Array as a "Hash Table"? Is that not
what it's for?


Absolutely not. the only thing that allows an Array to be used as a
"Hash Table" is the fact that arrays are instances of the native
ECMAScritp object, so it is their objectness that would be being
employed not their arrayness. Arrays are for referencing elements by
integer index, and automatically tracking the largest index assigned
with the length.
Note: I'm not trying to be a jerk or come off as dense;
I'm genuinely interested. Does the ECMAScript specification
require that an object not have inherent properties, or that
these properties not show up in a for..in loop?
All of the specification defined properties of Arrays and Objects are
marked with the - DontEnum - attribute and for-in is specified as not
enumerating properties marked - DontEnum -.
The specification is pretty lax on that, and I would
argue that you shouldn't be relying on those assumptions
in order for your program to work.
I don't think the specification is lax in this area (See the last
sentence of paragraph 11 in ECMA 262, 3rd Ed. Section 15). Implementers
are allowed to add properties as extensions, but it would be careless of
them not to mark such extension properties - DontEnum - themselves, and
I don't know of any implementation extensions to Array or Object that do
show up in for-in loops.
Incidentally, it seems like this particular problem ought
to be fixable by setting the DontEnum attribute of the
methods and properties that prototype.js adds to Object.
You don't design good javascript code by wishing javascript was some
other language. It is quite clear that that the attributes of properties
are not intended for runtime modification (otherwise the - Internal -
attribute would be listed separately as it would not make sense for that
one to be modifiable).

It was a poor design decision in Prototype.js to extend the prototypes
of Object and Array, and its authors cannot excuse themselves with a
desire not be creating the extra objects necessary to extend Array and
Object further down the prototype chain (or by augmentation) as the
library itself continually creates and discards an excessive number of
superfluous objects as it runs.
But I really have no idea if this is implemented in
user-agents; I'm sure someone would have implemented
into the library if it were feasible.
It is not.

<snip> ... prototype.js - I'm just arguing that the problems it
causes are ALSO a symptom of assumptions made by the people
who diss it.


Like assuming that the language specification is not explicit about the
enumerability of the properties it defines?

Richard.
Jun 28 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4653
by: chuck | last post by:
Hi, Firstly, I don't know if this is just and isolated thing with the prototype.js library or is a problem in general with ajax calls with a '+' character, so i am posting it here. I am trying to send input from a form to do a live php boolean search. so an example search string is
17
3296
by: Chaprasi | last post by:
Hi I need help with prototype while doing ajax calls. So this is my JS which does a ajax calls var ajax1 = new Ajax.Request ( url, { method: 'get', parameters: params, onComplete: showResults, onFailure: showFailure
1
3168
by: marc.fuehnen | last post by:
hi everybody, tried the framework and build a little SQL Update, triggered by a JS function: <a href="Javascript:updateData()"><img src="../images/thumbs/thumb_blue.png" border="0" /></a> <div id="yeah">
5
20072
by: dougwig | last post by:
I'm trying to handle the scenario where a user's session times out and and their ajax request triggers a redirection by the webserver (302 error?). I'm using Prototype 1.4 and the my works great with Firefox,but with IE6 the onFailure never gets called and the request never completes. My code: var ajaxReq = new Ajax.Request( url, {method: 'post', parameters:
7
1818
by: BeeRich | last post by:
Hi folks. I built an ajax.updater reply in a website on a Mac, and she works fine. It's a simple reply, the html supplied is correct, and I also supply the target DIV as well. Just wondering why a PC won't show anything. Cheers
3
2771
by: BG Mahesh | last post by:
hi We are looking for a good Ajax library which has very good support for iframe. The ones we have considered so far are, Backbase.com - not happy with the speed Zapatech.com - it is good but doesn't have support for iframe openreco.org - it is good but doesn't support iframe Any pointers is appreciated. We are doing the development on Linux.
23
1760
by: Dautkhanov | last post by:
Hello ! Does anybody have cutted version of prototype.js with the AJAX functionality only? I am a new in prototype.js topic, so I think this task should be done by other developers. Maybe protorype.js should be splitted into small pieces of the js scripts with groupped functionality
4
7704
by: ext237 | last post by:
Simple ajax call seems to have some issues in Firefox. The "onComplete:" is called BEFORE the response is returned by the call. Is there a coding issue or a work around? var ajax = new Ajax.Request( url, {method: 'post', parameters: params, onComplete: evalInfo }); function evalInfo( request ) { // do stuff with request
0
9182
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9041
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8928
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8890
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7757
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4634
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3060
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2355
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.