An idea from jQuery which might be borrowed to Prototype

16 views
Skip to first unread message

buda

unread,
Oct 19, 2011, 10:00:32 PM10/19/11
to prototype-s...@googlegroups.com
Hi!

Working on porting Microsoft DataLink plugin to Prototype i began learn jQuery and found one interesting thing; instead of workin whith JS objects in the way of Object.method(obj) they use wrap this object in so called jQuery object which already has all needed method and propeties to work with the object but keep original object inside untouched.
This has a benefit - original object is untouched and we can work wit it like it has everithing we need. 
And there is the second benefit - the wrap object has internal id !!! - so it can use storage like DOM element in Prototype.js but I cannot!

buda

unread,
Oct 19, 2011, 10:28:26 PM10/19/11
to prototype-s...@googlegroups.com
So, I need the idea to have an ability to any object use the storage

var a = {
  name: 'John',
  last: 'Pupkin'
}

add to 'a' an 'id' field - corrupt 'a' as object so I need a way to identify a to have an ability to use the storage
Any idea?
Message has been deleted
Message has been deleted

buda

unread,
Oct 20, 2011, 11:22:49 AM10/20/11
to prototype-s...@googlegroups.com
I've solved - here is working example
http://jsfiddle.net/DybH8/22/

Victor

unread,
Oct 27, 2011, 4:52:20 PM10/27/11
to prototype-s...@googlegroups.com
Jon Dow == John Doe? ;)

wwwboy

unread,
Oct 28, 2011, 7:47:53 AM10/28/11
to prototype-s...@googlegroups.com

It’s depend on your mood :)

--
You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group.
To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/2jp7KMInIvAJ.
To post to this group, send email to prototype-s...@googlegroups.com.
To unsubscribe from this group, send email to
prototype-scripta...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply all
Reply to author
Forward
0 new messages