Re: Why should I eschew prototype.js?
- From: Randy Webb <HikksNotAtHome@xxxxxxx>
- Date: Wed, 14 Nov 2007 21:54:45 -0500
dhtmlkitchen@xxxxxxxxx said the following on 11/13/2007 8:46 PM:
On Nov 13, 10:52 am, Randy Webb <HikksNotAtH...@xxxxxxx> wrote:
<snip>
It was Richard, not Robert, but, I don't think Richard was trying tothat's one issue. The other is that it's not semantic.
improve on Prototype.js as much as show the flaws in it. There is
another one that is, perhaps without a doubt, the mostly hotly debated
in this group and that is the use of $ as a function name. The main
issue is "ECMAScript says it is intended for machine generated code" and
people grasp onto that and want to condemn the practice simply because
"ECMAScript says so".
A method should do what it says. What does $ say it does? If it were a
shortcut to document.getElementById, I'd call unnecessary delegation,
but that's not the case.
No, that is not all that $ does in Prototype. Far from it. In fact, it is so convoluted you would have a hard time coming up with a "semantic" name for it that was under about 20 characters or so.
As for "unnecessary delegation", I can see a benefit to having a wrapper function as long as the function handled feature detection. Then you wouldn't have to write this every time:
if (document.getElementById){
//
}
You could simply write:
getRef('someElement')
And then have the function getRef handle the feature detection.
But, most of the discussions about the use of $ don't center on the semantics of it (although it has been mentioned in the past), the discussion centers on the "ECMAScript says don't do it" aspect of it.
The $ has been so overloaded to do xpath, et c in jQuery. In a way,
it's like those html pages where every tag is div.
Honestly, I have never looked at jQuery other than seeing snippets of it here so I can't comment on it. The only reason I have looked at Prototype.js lately is because of this thread.
<snip>
I don't think they "make" the standard as much as they "become" theI doubt that. So many HTML pages now, and people need to log in to
standard. Microsoft drives this market, whether people admit it or not.
It isn't a pro-MS or anti-MS sentiment, it is just a fact. If MS came
out next week and proclaimed "The only markup language we will support
in the future is MSML(Microsoft Markup Language), the only script
language we will support is MSScript (Microsoft Script), and nothing
else". Then the rest of the browser world would flip on it's head in an
effort to support them and the W3C would become a thing of the past.
their pages, et c. If IE doesn't support that feature (HTML) then it
would fall out of favor. MS would have to get users on to a new
platform first, and get enogh pgs developed on that platrofm to make
it really attractiuve,.
Let me clarify it a little differently as it is a little ambiguous as I wrote it. If MS came out and said:
<conjecture>
The only way IE will process a script block is if it is formatted in this manner:
<script type="MSScript">
//script code here
</script>
Furthermore, if any other attributes are present, IE will ignore the script block.
</conjecture>
Then you would see a TON of webpages get changed in a hurry. Would they ever do it? No. Could they do it and make it work? Absolutely. It is a bad side effect of having a dominating monopoly over the browser area.
Want a real world example though? XHTML. MS snubbed there noses at it and now it's a dead language. Not because it was bad, not because of anything other than the fact that MS doesn't support it. Not saying there aren't uses for it (there are). But for the web itself, it is a pretty dead language.
Microsoft didn't gain that advantage by offering a better product, they gained it by brute force of forcing IE onto the desktop and then integrating it into the OS.
Now that we are way off topic, I don't want to continue having a discussion about MS and the problems with it. Let's just get back to Prototype.js :)
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
.
- References:
- Why should I eschew prototype.js?
- From: nolo contendere
- Re: Why should I eschew prototype.js?
- From: Richard Cornford
- Re: Why should I eschew prototype.js?
- From: nolo contendere
- Re: Why should I eschew prototype.js?
- From: Gregor Kofler
- Re: Why should I eschew prototype.js?
- From: nolo contendere
- Re: Why should I eschew prototype.js?
- From: Randy Webb
- Re: Why should I eschew prototype.js?
- From: dhtmlkitchen@xxxxxxxxx
- Why should I eschew prototype.js?
- Prev by Date: Re: popup to mimic parent window
- Next by Date: Re: Why should I eschew prototype.js?
- Previous by thread: Re: Why should I eschew prototype.js?
- Next by thread: Re: Why should I eschew prototype.js?
- Index(es):
Relevant Pages
|