Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#18494 closed enhancement (worksforme)

support array operator in data-dojo-attach-point

Reported by: amitu Owned by:
Priority: undecided Milestone: tbd
Component: Parser Version: 1.10.4
Keywords: Cc:
Blocked By: Blocking:

Description

I am porting equalizer widget from foundation to dojo for a project, and I do not want to add individual cells whose height is to be equalised be available through query.

If I have only one node, I could have used _AttachMixin and data-dojo-attach-point, but I need array.

Looking at the code, https://github.com/amitu/dojo/blob/master/parser.js#L313, it seems it should be easy enough.

What I propose is data-dojo-attach-point accept names ending with [], e.g. data-dojo-attach-point="children[]", this currently fails, or rather does not capture all elements that have this attribute.

With small changes in parser we can create an array named children for this instance, and initialise it properly.

Does it make sense?

Change History (4)

comment:1 Changed 5 years ago by bill

Component: GeneralParser
Resolution: worksforme
Status: newclosed
Type: defectenhancement

IIRC data-dojo-attach-point already supports arrays. Just have multiple attach-points with the same name (ex: data-dojo-attach-point="foo". Let me know if that doesn't work for you.

comment:2 Changed 5 years ago by amitu

I just verified, this.children refers to last node encountered, not a list.

Even with list, I would prefer it was NodeList? not just a plain array containing dom nodes.

Can not reopen.

comment:3 Changed 5 years ago by amitu

Never mind. It works.

I had to put a variable by that name with initial value of empty array.

Some documentation would be great. If you can point me to right direction, I can may be update it?

comment:4 Changed 5 years ago by bill

Ok, glad it's working. The doc is at https://github.com/dojo/docs/blob/master/dijit/_AttachMixin.rst#data-dojo-attach-point. Feel free to submit a PR to update it.

Note: See TracTickets for help on using tickets.