Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 23 additions & 17 deletions content.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
$(document).keydown(function(e) {
// If backspace is pressed
if (e.which === 8) {
var active = $(document.activeElement);

notEditable = function(element) {
var edit = element.attr('contenteditable');

(function () {
var isWebInspector = !!$('body#-webkit-web-inspector');
$(document).keydown(function(e) {
// If backspace is pressed
if (e.which === 8) {
var active = $(document.activeElement);

// Ensure backspace still works on any element with contenteditable="true"
if (typeof edit !== 'undefined' && edit !== false) {
return true;
} else if (element.is('input, textarea')) {
return true;
notEditable = function(element) {
var edit = element.attr('contenteditable');

// Ensure backspace still works on any element with contenteditable="true"
if (typeof edit !== 'undefined' && edit !== false) {
return true;
} else if (element.is('input, textarea')) {
return true;
} else if (isWebInspector && (element.attr('id') === 'console-prompt')) {
return true;
}

return false;
}

return false;
return notEditable(active);
}

return notEditable(active);
}
});
});
}());
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "BackStop",
"description": "Stop Backspace returning to previous page.",
"version": "2.0.1",
"version": "2.0.2",
"manifest_version" : 2,
"icons": {
"16": "logo16.png",
Expand Down