coding efficiency question - DOM object with custom properties

E

EventListener

I need to drag a <div> around and drop it. The onDrop method then needs
to get some extra information about what to do.

I see two ways of adding this information
1. Creating a wrapper class for the div.
2. Adding the custom information as a property of the div itself.

I am wondering about the pros and cons of these ways -- both for
efficiency and style. Number 1 seems like it is code heavy - making
another Object, yet another layer of contex. But Number 2 seems like it
violates OO principles - a div and my custom information have nothing
to do with each other.

Any thoughts?

Cathy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top