an anon child
}
}
if (control) {
control.labelElement = this;
}
var afterLabel = document.getAnonymousElementByAttribute(this, "anonid", "accessKeyParens");
afterLabel.textContent = ""; // This does not clear real nodes!
var oldAccessKey = this.getElementsByAttribute('class', 'accesskey').item(0);
if (oldAccessKey) { // Clear old accesskey
this.mergeElement(oldAccessKey);
}
var oldHiddenSpan =
this.getElementsByAttribute('class', 'hiddenColon').item(0);
if (oldHiddenSpan) {
this.mergeElement(oldHiddenSpan);
}
var accessKey = this.accessKey;
var labelText = this.textContent;
if (!accessKey || !labelText || !control) {
return;
}
var accessKeyIndex = -1;
if (!this.mAlwaysAppendAccessKey) {
accessKeyIndex = labelText.indexOf(accessKey);
if (accessKeyIndex < 0) { // Try again in upper case
accessKeyIndex =
labelText.toUpperCase().indexOf(accessKey.toUpperCase());
}
}
const HTML_NS = "http://www.w3.org/1999/xhtml";
var span = document.createElementNS(HTML_NS, "span");
span.className = "accesskey";
// Note that if you change the following code, see the comment of
// nsTextBoxFrame::UpdateAccessTitle.
// If accesskey is not in string, append in parentheses
if (accessKeyIndex < 0) {
// If end is colon, we should insert before colon.
// i.e., "label:" -> "label(X):"
var colonHidden = false;
if (/:$/.test(labelText)) {
labelText = labelText.slice(0, -1);
var hiddenSpan = document.createElementNS(HTML_NS, "span");
hiddenSpan.className = "hiddenColon";
hiddenSpan.style.display = "none";
// Hide the last colon by using span element.
// I.e., label:
this.wrapChar(hiddenSpan, labelText.length);
colonHidden = true;
}
// If end is space(U+20),
// we should not add space before parentheses.
var endIsSpace = false;
if (/ $/.test(labelText)) {
endIsSpace = true;
}
if (this.mInsertSeparator && !endIsSpace)
afterLabel.textContent = " (";
else
afterLabel.textContent = "(";
span.textContent = accessKey.toUpperCase();
afterLabel.appendChild(span);
if (!colonHidden)
afterLabel.appendChild(document.createTextNode(")"));
else
afterLabel.appendChild(document.createTextNode("):"));
return;
}
this.wrapChar(span, accessKeyIndex);
]]>
= node.length) {
index -= node.length;
node = treeWalker.nextNode();
}
if (index) {
node = node.splitText(index);
}
node.parentNode.insertBefore(element, node);
if (node.length > 1) {
node.splitText(1);
}
element.appendChild(node);
]]>
!/Mac/.test(navigator.platform)
true
false