Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#12376 closed defect (fixed)

_setXXXAttr() method names for attribute names with dashes

Reported by: bill Owned by: bill
Priority: high Milestone: 1.7
Component: Dijit Version: 1.6.0rc1
Keywords: Cc: Douglas Hays
Blocked By: Blocking:


For an attribute name like "accept-charset", one would expect to write a custom setter named _setAcceptCharsetAttr().

However, this doesn't work, dijit currently requires a setter name like "_setAccept-charsetAttr", using quotes:

"_setAcceptCharset-charsetAttr": function(){ ... }

This is unexpected and inconsistent with how JS handles CSS attributes with dashes, for example "text-align" becomes

Fix this.

Change History (2)

comment:1 Changed 11 years ago by bill

Resolution: fixed
Status: newclosed

(In [23960]) Handle custom setter names for attribute names with dashes, ex: the setter for "tab-index" is setTabIndexAttr() not "setTab-indexAttr"().

Since a custom setter can map to multiple attribute names (ex: _setTabIndexAttr() could be for "tabIndex", "tab-index", "Tab-Index", etc.), applyAttributes() depends on the widget declaring the attribute in addition to having a custom setter. Hopefully there won't be too many hiccups from this; I fixed the dijit cases (ContentPane, AccordionContainer) where this wasn't being done.

Fixes #12376 !strict.

comment:2 Changed 11 years ago by bill

(In [23983]) Need to declare "closeButton" parameter since there's a custom setter for in (albeit in TabButton, not StackButton). Fixes right-click close menu for tab buttons. Refs #12376 !strict.

Note: See TracTickets for help on using tickets.