Loading ...
Sorry, an error occurred while loading the content.
 

Re: [ydn-javascript] Re: Yahoo! UI developers read this list?

Expand Messages
  • Peter Michaux
    Hi, As I ve explored the Yahoo! UI library more I realize that there is an inconsistency for specifying html elements as parameters to the library functions.
    Message 1 of 18 , Apr 23 6:04 PM
      Hi,

      As I've explored the Yahoo! UI library more I realize that there is an
      inconsistency for specifying html elements as parameters to the
      library functions.

      For the dragdrop library, an element id must be submitted which causes
      some problems and the requirement of dummy ids being created. This is
      will cause bugs for people that don't carefully create the dummy ids
      and end up with duplicate ids. Also it is a pain to create these dummy
      ids. Also if the library is using these dummy ids for more than just
      finding the element then I think this is probably very inefficient.

      The Yahoo! UI event library gives options for specifying the element

      http://developer.yahoo.com/yui/event/index.html#start

      To specify the element you can send addListener() an id string or a
      DOM element or even an array of id strings. (I don't know if you can
      send an array of DOM elements.)

      Could the Yahoo! dragdrop library be made to work like the Yahoo!
      event library for both consistency and easy of use?

      Thanks,
      Peter


      On 4/11/06, Peter Michaux <petermichaux@...> wrote:
      > On 4/11/06, Matt Warden <mwarden@...> wrote:
      > >
      > > Presumably, it would do something like this:
      > >
      > > if (arg is dom element) {
      > > if (arg has an id) {
      > > save the id in a var
      > > }
      > > else {
      > > assign a unique id to arg
      > > }
      > > }
      >
      > I wasn't thinking this at all. I don't think the Yahoo library should
      > assign an id or ever save the id in a variable. I haven't had time to
      > read all the code yet. Is it doing this now? If the library is using
      > the id to find the element multiple times then that is inefficient.
      > Find the element once and then store the element.
      >
      > if (arg is dom element) {
      > this.element = arg;
      > } else {
      > this.element = document.getElementById(arg);
      > }
      >
      > Now if you ever need the element again you already have it. No need to
      > use the id to find it again.
      >
      >
      > > but what if i create the element, pass it to the drag/drop constructor,
      > > and then assign it an id?
      >
      > Yes this would be a problem. But why does the Yahoo library ever need
      > to know the id of the element other than to find the element the first
      > time?
      >
      > - Peter
    Your message has been successfully submitted and would be delivered to recipients shortly.