Opened 12 years ago
Closed 11 years ago
#9000 closed enhancement (fixed)
innerText attribute type for dijit's attributeMap; setInnerText method
Reported by: | matthw | Owned by: | bill |
---|---|---|---|
Priority: | high | Milestone: | 1.4 |
Component: | Dijit | Version: | 1.3.0rc2 |
Keywords: | innerText attributeMap dijit attribute dojo.html | Cc: | |
Blocked By: | Blocking: |
Description
(as requested a separate ticket for this)
It would be nice if you could use dijit's attributeMap magic with text-based setters as well as html-based. This could be added via a new attribute type 'innerText', eg:
attributeMap: { title: { node: "titleNode", type: "innerText" } }
When you're dealing with dynamic or user-input content you'll almost always want to be treating it as text rather than as html... or at least so I've found. So the option would be nice, whether or not it's the default.
It would also be nice to have a reusable 'setInnerText' method in dojo.html or dojo._base.html, which could be used to implement this and elsewhere too. It would save a lot of boilerplate along the lines of:
dojo.html.set(someNode, ''); someNode.appendChild(dojo.doc.createTextNode(text));
Which I see repeated in a lot of dijit code.
(or if preferred this could be implemented as an option to dojo.html.set; in this case it obviously wouldn't work in combination with passing DOM nodes as the content to set)
I'd be happy to make a patch adding this functionality, looks like it should be quite a clean/easy thing to add. Just let me know how you'd prefer it done.
Change History (6)
comment:1 Changed 12 years ago by
Component: | General → Dijit |
---|---|
Owner: | anonymous deleted |
comment:2 Changed 12 years ago by
I haven't done a CLA yet, but should be fine. Is there any process involved to start contributing or do I just fax one over and post the patch on the relevant ticket?
comment:3 Changed 12 years ago by
@matthw - just fax/email the signed CLA, and attach the patch. Future patches you can go ahead an add [cla][patch] to the title so it stands out, which will we do for this ticket once the CLA is verified etc. thanks!
comment:4 Changed 12 years ago by
Milestone: | tbd → future |
---|
comment:5 Changed 11 years ago by
Milestone: | future → 1.4 |
---|---|
Owner: | set to bill |
Status: | new → assigned |
Hi matthw,
Sure a patch would be great if you've signed a CLA, hopefully w/a new little test for it in _Widget-attr.html (which is the extent of attributeMap tests that we have today).