Index: lib/utils.js |
=================================================================== |
--- a/lib/utils.js |
+++ b/lib/utils.js |
@@ -483,24 +483,34 @@ let Utils = exports.Utils = |
} |
}, |
/** |
* Split all labels starting from a particular DOM node. |
*/ |
splitAllLabels: function(/**DOMNode*/ root) |
{ |
- let elements = root.querySelectorAll("*[label], label[value]"); |
+ let attrMap = { |
+ __proto__: null, |
+ "label": "value", |
+ "setting": "title" |
+ }; |
+ |
+ let elements = root.querySelectorAll("*[label], label[value], setting[title]"); |
for (let i = 0; i < elements.length; i++) |
{ |
let element = elements[i]; |
- let attr = (element.localName == "label" ? "value" : "label"); |
- let [label, accesskey] = this.splitLabel(element.getAttribute(attr)); |
- element.setAttribute(attr, label); |
- element.setAttribute("accesskey", accesskey); |
+ let attr = (element.localName in attrMap ? attrMap[element.localName] : "label"); |
+ let origLabel = element.getAttribute(attr); |
+ |
+ let [label, accesskey] = this.splitLabel(origLabel); |
+ if (label != origLabel) |
+ element.setAttribute(attr, label); |
+ if (accesskey != "") |
Wladimir Palant
2013/07/09 12:10:59
The added checks here aren't strictly necessary bu
|
+ element.setAttribute("accesskey", accesskey); |
// Labels forward changes of the accessKey property to their control, only |
// set it for actual controls. |
if (element.localName != "label") |
element.accessKey = accesskey; |
} |
} |
}; |