JQuery Or Prototype ?

May 16, 2007

I want ask you if, for a web portal/application, is better prototype or Jquery? I don't want to innesc some type of flame, but after the announce that drupal use JQuery and that the new Wordpress
2.2 use Jquery I ask myself if my choice of use prototype.js is the bettere choice.

View 5 Replies


ADVERTISEMENT

Difference Between Object.prototype And Function.prototype?

Nov 25, 2011

According to ECMAScript, the root of the prototype chain is Object.Prototype. Each object has an internal property [[Prototype]] that could be another object or NULL.... However, it also says that every function has the Function prototype object: Function.Prototype, it confused me, because a function is an object, for a function object, what is its function prototype and object prototype..For example:

var x = function (n) {return n+1;};

what is the relationships of x, Object.Prototype and Function.Prototype

View 5 Replies View Related

How Come Object.prototype Inherits From Function.prototype

Dec 14, 2009

I am trying to get to the bottom of javascript object, prototypes etc. I have a fairly good grasp of it, but I get confused the closer I get to the base object.prototype. FIrst of all, I was under the impression that all objects descend directly from Object. But some objects (like Array) seem to inherit properties and methods from the function.prototype. So does this mean that the chain is like this:

object -- function -- array Second, I noticed (on the mozilla javascript reference site that object.prototype inherits properties and methods from function.prototype and vice versa!? How can this be? I must be missing something important about understanding the chain?

View 24 Replies View Related

JQuery :: When Is Use Of The Prototype Object Appropriate, And When Is It Not?

May 7, 2009

QUESTION ONE: When is use of the jQuery prototype object appropriate, and when is it not?

BACKGROUND:I am still trying very hard to identify the error that is prohibiting me from incorporating a jQuery plug-in into my site in a manner similar to the way that the author of the plug-in has incorporated it into his.Although I have sought consultation with the author, he appears uninterested in working with me.My still fledgling knowledge of jQuery tells me that the author of the plug-in and my implementation of his plug-in are constructed differently.Whereas I use jQuery's prototype property to reference my method and then assign my method anonymously to my HTML document as follows: $().myJQMethod().The author of the plug-in does something very different.I have extracted from the author's plug-in and my implementation of it. Links to the source pages have been included.

CONSTRUCT A (The jQ_Impromptu Plug-In):
(function($) {
$.prompt = function(message, options) {
})(jQuery);[code]...

QUESTION TWO: Although I am able to implement the author's method, it is not performing as it should. When the alert box appears with focus the hosting HTML page is suppose to show through with dimmed opacity.My implementation does not achieve this effect. Firebug has alerted to me to the following breakpoint, but I am poorly unable to interpret it.

View 3 Replies View Related

JQuery :: Prototype Noconflit() And IE8 ?

Nov 30, 2010

I read the documentation on the noconflicts() to mean that Prototype should be loaded first and then:

<script

This all worked great in all browsers except in IE8 which had no clue what jQuery() meant. IE8 says jQuery is undefined.

So I reversed the order of loading, jQuery first then Prototype, and now everybody is happy. Did I just read the documentation wrong or is there something else here I should be worried about?

View 2 Replies View Related

JQuery :: How To Handle Conflict With Prototype

Apr 10, 2010

I am using protype for valadation and Jquery am using for calendar, Here is my script ,

[Code]...

View 3 Replies View Related

JQuery :: Calling Internal Methods Of A Prototype?

Nov 24, 2011

I've previously written an image carousel with lightbox and to be honest forgot about it for quite a long time. I've just been tasked with making a few modifications (I wrote this code about 6 months ago)

Now, the problem I have is that I now need to call the internal method from the ligthbox plugin.

I've tried setting a reference to this like this but it just won't play ball. I can see that the ajax feed gets called but unfortunately I can't then access it.

[Code]...

View 3 Replies View Related

JQuery :: Equivalent Of Prototype Function.bind?

Jan 5, 2010

Is there a jQuery way of doing this Prototype bind?

var func = myFunction;
setTimeout
func.bind
this
, 1000
;

View 2 Replies View Related

JQuery :: Not Working In Weebly Despite Prototype Workaround?

Dec 9, 2010

I have developed a widget. I am using the jquery core api. Im having a problem when the widget is used in a weebly site. I know weebly uses prototype and I am using the workaround:

var $j = jQuery.noConflict(); however there is still a clash of some sort. I think every prototype.js function is being called or something because the page is taking a long long time to load as there are many requests being made which look like this:

[Code]...

View 3 Replies View Related

JQuery :: Making Sense Of Prototype Debates?

Apr 22, 2010

So for a research topic at school, I chose to do web development software trends, to see if there are any general commonalities. One sub-topic I chose to do was Javascript, and where it seems to be heading. After reading a bit about it (I'm very new to web development), I learned that jQuery and Prototype seemed to be the most popular options when using javascript, but I didn't understand why they are compared against each other so often. If jQuery is a library, and Prototype is a framework, why would people only choose one or the other? I know some people use both, and I also realize that there's minor conflicting syntax issues, but I was hoping someone with more experience could help me understand why a framework and a library can be compared head to head.

View 6 Replies View Related

JQuery :: How To Create Prototype And Custom Object

Apr 17, 2010

I am newer in Jquery. How to create the prototype object and custom object in Jquery.

View 2 Replies View Related

JQuery :: Sencha Api - Ext Js 4 Api - Yql - Prototype - Design And Interface?

Jun 10, 2011

Which one is easier? and which gives best design and interface?

View 1 Replies View Related

Jquery :: Conflict Between Libraries - Mootools And Prototype

Feb 23, 2011

I have been trying in vain for many days to resolve a conflict between javascript libraries. My homepage uses jquery horizontal css menubar + a combined mootool and prototype accordian type sliding information box in the middle of the webpage. I find that the highlighter of the css menubar does not work when prototype.js is also loaded on the same page. I have read somewhere that $ should be replaced however I have tried every possible option and none works. I have jquery loading first as it is on my template, with this:
<script type='text/javascript' src='../Web/Templates/jquery-1.3.2.js'></script>
<script type='text/javascript' src='js/example.js'></script>

And my mootool and prototype loades further below like this:
<script type="text/javascript" src="scripts/intro/prototype.lite.js"></script>
<script type="text/javascript" src="scripts/intro/moo.fx.js"></script>
<script type="text/javascript" src="scripts/intro/moo.fx.pack.js"></script>
<script type="text/javascript">
function init(){
var stretchers = document.getElementsByClassName('box');
var toggles = document.getElementsByClassName('tab');
var myAccordion = new fx.Accordion(
toggles, stretchers, {opacity: false, height: true, duration: 600}
);
//hash functions
var found = false;
toggles.each(function(h3, i){
var div = Element.find(h3, 'nextSibling');
if (window.location.href.indexOf(h3.title) > 0) {
myAccordion.showThisHideOpen(div);
found = true;
}
});
if (!found) myAccordion.showThisHideOpen(stretchers[0]);
}
</script>

View 1 Replies View Related

JQuery :: Adding Prototype Function As An Event Handler?

Aug 30, 2010

I need to know how to add an event to a button. The specific issue is that I want to add an event which is a prototype function of a class. Consider the following as an example:

MyTestClass = function() {
this.firstName = "Pete";
this.lastName = "Johnson";

[code]....

View 2 Replies View Related

JQuery :: Plugin - Function (Prototype) Test Unknown

Jan 8, 2010

I want to write a plugin, say 'myPlugin' which I can use like
Code:
$('#myID').myPlugin() ;
$('#myID').myPlugin.test() ;

The plugin I wrote looks like
Code:
(function($){
$.fn.myPlugin = function() {
// do something
} $.fn.myPlugin.test = function() {
var $this = $(this) ;
// do something ;
}})(jQuery) ;

This works and it doesn't work. It works because test() is called, but this is not the element with id '#myID' it is $.fn.myPlugin. To fix this I tried the following
Code:
(function($){
$.fn.myPlugin = function() {
// do something
} $.fn.myPlugin.prototype.test = function() {
var $this = $(this) ;
// do something ;
}})(jQuery) ;
but now the function 'test' is unknown.

View 6 Replies View Related

JQuery :: Load Method Super As Smartupdater OrPeriodicalUpdater (Prototype)?

Feb 27, 2011

I tried load method super as smartupdater orPeriodicalUpdater (Prototype). Now the problem is that I have to build a cycle (loop) and each time I have to change the time (that I take from database) so how method (function) can I use to load external code (example load()) modifying continuosly the timeout?

View 1 Replies View Related

With And Prototype

Aug 24, 2005

I can use "with" like this:

function MyObject(message)
{
this.message = message;
}
function _MyObject_speak()
{
alert(this.message);
}

with (MyObject)
{
prototype.speak = _MyObject_speak;
}


I was wondering why I can't use "with" like this:

with (MyObject.prototype)
{
speak = _MyObject_speak;
}

View 8 Replies View Related

Cracking Prototype.js

Jul 23, 2005

One of the complaints about prototype.js (google for it if you're not
familiar with it) is that it's poorly documented. I have this inkling
that the key to understanding prototype.js is in the bind function.

The problem with Javascript is that the "this" operator is poorly
overloaded and it is often hard to understand in the context of
object-oriented javascript

So, let's start with the definition:

Function.prototype.bind = function(object) {
var method = this;
return function() {
method.apply(object, arguments);
}
}

As I read this, it states that all functions (which are themselves
objects) will, in the future, have an associated method called "bind".
The function() function, so to speak, simply instantiates a Function
object with the parameter list and then evals the statement, sticking
the resulting execution-tree in the current code frame.

The "this" there refers to the function object associated with the call
to bind(), right? But the word "arguments" there refers to the
arguments passed to the function object *generated by* the call to
bind().

In every example within prototype.js, bind() is called either in a
constructor or within a method contexted to a javascript object, and is
always called with "this" as its argument, e.g.:

this.options.onComplete = this.updateContent.bind(this);

As I read the code it seems to be stating that the "this" object
referred to within bind()'d functions are being coerced into always
referring to the current instantiated object.

But isn't this always the case anyway? Is this a rather confusing
attempt to ensure "this" purity whereby the call

method.apply(object, arguments)

is forced to always have the reference to the containing object present?

I think I've got it. Bind() generates uniq functions that contain live
references to the objects to which they belong, such that the function
object can then be passed to setTimeout() or onMouseOver(), handlers
that accept functions but not objects.

View 8 Replies View Related

Object.prototype

Mar 15, 2006

Lets say we run: window.alert = function() { };

Is there anyway to 'restore' the original alert() method or is it gone
forever?

I know you can do window.alert = Window.prototype.alert, but lets say
you also set Window.prototype.alert = function() { } or lets say we're
in Opera, which doesnt have a Window "class".

View 3 Replies View Related

Prototype.js BindAsEventListener Without 'this'

Jun 5, 2006

I would like to set up an event observer outside of an object, so I
can't use this.bindAsEventListener. How can I pass the correct object
reference?

I tried something like this, and various other variations, but no luck.
This works when I set it up from inside the object, using "this.",

Event.observe(targetId,'click',targetId.select.bin dAsEventListener(this),false);

View 28 Replies View Related

Object As A Prototype.

Jan 11, 2007

I wanted to add an object as a prototype to separate my methods more
nicely, however, I ran into a couple of problems. Apart from the
obvious "scope" issues I found that any instances of my class shared
the objects methods and properties.

I realise (now) that this is actually how prototypes work, they share
functions and objects rather than create new instances of them for
every "class", but is there any way around it? (or shouldn't I be doing
things like this at all?) Code:

View 2 Replies View Related

Having More Than One Object Without Using Prototype

Jan 23, 2007

I am working on my own pop up calendar, mainly because the one I am currently using crashes the Safari browser at times.

So, I want to verify that what I am doing will work, in that I want to be able to have multiple calendars open at the same time, each independent of the other.

So, I start it off with:

var Calendar = {
dateSelected: null,
topPos:null,
leftPos:null,

somefunction:function(e) {
...
}
};

If I create more than one calendar object, will they have their own variables, in that the dateSelected, topPos and leftPos will be unique to that instance?

Or, is there a better way to do this, that is cross-platform.....

View 8 Replies View Related

Prototype Inheritance

Mar 4, 2007

In my research in the javascript language I have encountered problems
with implementing prototype inheritance while preserving private
methods functioning properly. Here is an example: Code:

View 2 Replies View Related

Updating A Div With Prototype

May 17, 2011

I have <div id ="changeable"> with some html in it. I have a link that calls the function to replace the info in the div. The problem is that the "creative_development.inc" file is added to the top of the div and does not replace the content. How do I replace the content, and not just add content?

View 1 Replies View Related

This.prototype.addEvent

Nov 20, 2007

I'm trying to make an addEvent function that will automatically attach itself to the object using a class.

My question is how can I add the function so when I write obj.addEvent("click",myfunction); it will add the event?

Here's my current function:
this.prototype.addEvent = function(type,fn)
{
if(window.attachEvent)
this.attachEvent("on"+type,fn);
else if(window.addEventListener)
this.addEventListener(type,fn,false);
}

View 4 Replies View Related

IE And Prototype Problem

Dec 13, 2007

I need help to workaround the following problem:

First, about the environment:
- The web pages automatically generated.
- Pages can be inserted to each other
- When a subpage to be inserted is being generated, it does not know will it be inserted or not.
- That because each subpage uses the <script src=...> tags to load the script it needs.
- in the external script files I'm trying to protect it from repeated execution checking (if(){}) the value of a variable which is created after in the script.

Everything worked fine until I tried to use the .prototype to declare the method of my objects.

In the Internet Explorer, I got "Object does not support this property or method", on the access to a prototype function, because the prototype of my object was deleted by itself after the second load of the external script. Code:

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved