Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#4871 closed defect (wontfix)

make dijit work with code that extends prototype of native JavaScript objects

Reported by: guest Owned by:
Priority: high Milestone: 1.0
Component: Dijit Version: 0.9
Keywords: Cc:
Blocked By: Blocking:

Description

dojo fails to load if mixed with code that extends native JavaScript? object like prototype.js does.

Attachments (1)

dojo_prototype_fix.patch (986 bytes) - added by guest 12 years ago.

Download all attachments as: .zip

Change History (7)

Changed 12 years ago by guest

Attachment: dojo_prototype_fix.patch added

comment:1 Changed 12 years ago by guest

the suplied patch makes dojo load without errors at least, I'm pretty sure there's much more work to do to make every function work

comment:2 Changed 12 years ago by bill

Summary: make dojo work with code that extends prototype of native JavaScript objectsmake dijit work with code that extends prototype of native JavaScript objects

Hi.

  • have you filed a CLA? (who are you?)
  • is this a problem w/Prototype? w/the latest version of Prototype?
  • it seems like you are calling hasOwnAttribute() on attributeMap which is a native JS object not a DOM object. I'm confused.

comment:3 Changed 12 years ago by guest

Hi!

  • No I haven't filed a CLA, Where/How? to do this? My name's Stefan Strigler (steve@…). Amongst others I'm author of JSJaC, a library for writting web based jabber clients and JWChat, a web based jabber client. Currently I'm about to implement a web chat framework out of both of them using dojo.
  • it's not a problem w/ Prototype only, it occurs everytime you extend the prototype of 'Object', e.g. if you do sth like this:

Object.prototype.toJSONString = function() { ... }

Then if you iterate over ANY object's properties you'll have 'toJSONString' as a property, which might cause unforeseen effects. For details see http://yuiblog.com/blog/2006/09/26/for-in-intrigue/

Cheers, Steve

comment:4 Changed 12 years ago by guest

Just found another good read on the topic to avoid those hassles: http://dean.edwards.name/weblog/2006/07/enum/

comment:5 Changed 12 years ago by bill

Resolution: wontfix
Status: newclosed

OK, you shouldn't be modifying the Object prototype anyway, and note that although that was a problem with previous versions of Prototype it hasn't been an issue for a while, so we aren't going to fix this. Sorry!

comment:6 Changed 12 years ago by dante

(In [11117]) refs #4871 - commented out example of loading prototype.js into themeTester after having verified it's not breaking anything.

Note: See TracTickets for help on using tickets.