Bug 808964 - AccessKeyLabel should be empty string for elements without the accesskey attribute,r=smaug

This commit is contained in:
s@rednaks.tn 2012-11-07 20:47:34 +02:00
parent e14946ab94
commit fe869f336f
2 changed files with 13 additions and 4 deletions

View File

@ -451,11 +451,13 @@ nsGenericHTMLElement::GetAccessKeyLabel(nsAString& aLabel)
{
nsPresContext *presContext = GetPresContext();
if (presContext &&
presContext->EventStateManager()->GetAccessKeyLabelPrefix(aLabel)) {
nsAutoString suffix;
GetAccessKey(suffix);
if (presContext) {
nsAutoString suffix;
GetAccessKey(suffix);
if (!suffix.IsEmpty() &&
presContext->EventStateManager()->GetAccessKeyLabelPrefix(aLabel)) {
aLabel.Append(suffix);
}
}
return NS_OK;

View File

@ -72,6 +72,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=583533
is(label, document.getElementById("e").accessKeyLabel, "JS and C++ agree on accessKeyLabel");
/** Test for Bug 808964 **/
var div = document.createElement("div");
document.body.appendChild(div);
is(div.accessKeyLabel, "", "accessKeyLabel should be empty string");
</script>
</pre>
</body>