Opened 8 years ago

Closed 6 years ago

Last modified 6 years ago

#12846 closed enhancement (wontfix)

Method "startupAt" for widgets

Reported by: lazaridis_com Owned by: bill
Priority: low Milestone: tbd
Component: Dijit Version: 1.6.0
Keywords: Cc:
Blocked By: Blocking:

Description

The "startupAt" function would work similar to the existent "placeAt". It would do nothing more than:

  • call placeAt(node)
  • call startup
  • return this

The usage would be simple:

tree1 = new Tree().startupAt('TreeDiv');

Related discussion:

http://dojo-toolkit.33424.n3.nabble.com/Instantiation-of-a-Widget-simplest-way-tp2867781p2894507.html

Change History (5)

comment:1 Changed 8 years ago by Karl Tiedt

What advantage does this beyond obfuscating placeAt() over the previous developers suggestion of making startup() return "this" so:

widg = new widget().placeAt(node).startup();

works as expected?

comment:2 Changed 8 years ago by lazaridis_com

Making startup() chainable was my initial thought, but I refrained, as this can break existent behavior.

Additionally, if I would see code where "placeAt(node).startup();" is used repeatedly, I would immediately ask: why not in one function, e.g. "startupAt"?

(please use the mailing-list topic for further discussion, I've understood that this is the process within the project)

comment:3 Changed 6 years ago by dylan

Component: DojoX WidgetsDijit
Owner: changed from dante to bill
Priority: highlow
Status: newassigned

Bill, thoughts on this one? This is a suggestion for a syntactic sugar clean-up for placeAt + startup.

comment:4 Changed 6 years ago by bill

Resolution: wontfix
Status: assignedclosed

placeAt() does return "this", so placeAt(node).startup() is possible.

Also, since [28251] placeAt() sometimes calls startup() implicitly, but not in all cases. Maybe that should be changed for 2.0. I'll add a note to the code for that.

But I don't want to add a separate startupAt() method.

comment:5 Changed 6 years ago by bill

In [30830]:

add todo for 2.0, refs #12846 !strict

Note: See TracTickets for help on using tickets.