Closed
Bug 655225
Opened 14 years ago
Closed 14 years ago
page jumps up when clicking on generated buttons
Categories
(Add-on SDK Graveyard :: General, defect)
Tracking
(Not tracked)
RESOLVED
INVALID
People
(Reporter: mcepl, Unassigned)
Details
Attachments
(1 file)
|
381.89 KB,
video/webm
|
Details |
Buttons generated with this function make the page jump up when clicked (see attached screenshot).
/**
* Generic function to add new button to the page. Actually copies new button
* from the old one (in order to have the same look-and-feel, etc.
*
* @param location
* Object around which the new button will be added
* @param after
* Boolean before or after location ?
* @param pkg
* String which package to take the command from
* @param id
* String which command to take
* @return none
*/
function createNewButton (location, after, cmdObj) {
try {
var newId = cmdObj.name.toLowerCase().replace(/[^a-z0-9]+/,"","g") + "_btn";
} catch (e) {
console.error("createNewButton : e = " + e +
"\ncreateNewButton : cmdObj.toSource() = " +
cmdObj.toSource());
}
// protection against double-firings
if (document.getElementById(newId)) {
console.log("Element with id " + newId + " already exists!");
return ;
}
var newButton = document.createElement("input");
newButton.setAttribute("id", newId);
newButton.setAttribute("type", "button");
newButton.value = cmdObj.name;
newButton.addEventListener("click", function(evt) {
executeCommand(cmdObj);
}, false);
var originalLocation = document.getElementById(location);
try {
if (after) {
originalLocation.parentNode.insertBefore(newButton,
originalLocation.nextSibling);
originalLocation.parentNode.insertBefore(document
.createTextNode("\u00A0"), newButton);
}
else {
originalLocation.parentNode.insertBefore(newButton, originalLocation);
originalLocation.parentNode.insertBefore(document
.createTextNode("\u00A0"), originalLocation);
}
} catch (e) {
if (e instanceof TypeError) {
console.error("cannot find originalLocation element with id " + location);
}
else {
throw e;
}
}
}
This is a bad bug report, I know, but I have no idea, how to troubleshoot it further. There is no error or warning anywhere. Page just jumps up a bit.
| Reporter | ||
Comment 1•14 years ago
|
||
PEBKAC ... CC list gets focus, so the screen rolls there.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•