Open Bug 306517 Opened 19 years ago Updated 2 years ago

mouseup fails to fire when part of a table is selected

Categories

(Core :: DOM: Events, defect, P5)

x86
Windows 2000
defect

Tracking

()

UNCONFIRMED

People

(Reporter: felipe, Unassigned)

References

(Depends on 1 open bug, )

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6

In the code pasted in below and at the referenced URL, the mouseup event fails
to fire when following a mousedown over an empty table cell if some of the table
is already selected.

Reproducible: Always

Steps to Reproduce:
1. Click and drag from the first row to the "foo" cell
2. Click and drag in the empty cells on the right. (The cursor should be a
circle with a slash.)
3. Observe that "mouseup" doesn't fire when you release the mouse here.
Actual Results:  
No mouseup event.

Expected Results:  
A mouseup event should fire.

<html>
<head></head>
<body>
<table id='myTable' border='1'>
<tr><td>1</td><td>2</td><td></td></tr>
<tr><td>1</td><td>2</td><td></td></tr>
<tr><td>1</td><td>2</td><td></td></tr>
<tr><td>1</td><td>2</td><td></td></tr>
<tr><td>1</td><td>2</td><td></td></tr>
<tr><td>1</td><td>2</td><td></td></tr>
<tr><td>1</td><td>2</td><td>foo</td></tr>
</table>
<script>
var theTable = document.getElementById('myTable');
var reportMouse = function(e) { debugWindow.show(e.type); };
theTable.addEventListener('mousedown', reportMouse, false);
theTable.addEventListener('mouseup', reportMouse, false);
</script>
</body>
<script>
//USE: debugWindow.show('key','value');
//
//SHOULDN'T NEED THIS, BUT: debugWindow.hide()

var DebugWindow = function(styleAttributes) {
	var thisCopy = this;

	this.pane = document.createElement('div');
	this.pane.style.position = 'fixed';
	this.pane.style.top = 0;
	this.pane.style.right = 0;
	this.pane.style.display = 'none';
	this.pane.style.fontSize = 'small';
	this.pane.style.width = '200px';
	this.pane.style.backgroundColor = 'darkred';
	this.pane.style.color = 'white';

	for (var attribute in styleAttributes) {
		this.pane.style[attribute] = styleAttributes[attribute];
	}

	var header = document.createElement('h4');
	header.appendChild(document.createTextNode('Debug Window'));

	this.messageDiv = document.createElement('div');

	var hideButton = document.createElement('button');
	hideButton.appendChild(document.createTextNode('Hide'));
	hideButton.onclick = function() {
		thisCopy.hide();
	}

	this.data = {};

	this.pane.appendChild(header);
	this.pane.appendChild(document.createElement('hr'));
	this.pane.appendChild(this.messageDiv);
	this.pane.appendChild(document.createElement('hr'));
	this.pane.appendChild(hideButton);
	document.body.appendChild(this.pane);

	return this;
}

//KEYS MUST EVALUATE TO BOOLEAN TRUE
DebugWindow.prototype.show = function(key, newValue) {
	this.pane.style.display = 'block';

	if (key) {
		var keyExists = this.data[key];
		var newTextNode = document.createTextNode(newValue);

		if (keyExists) {
			this.data[key].value = newValue;
			this.data[key].elem.replaceChild(
			   newTextNode, this.data[key].elem.lastChild
			);
		} else {
			this.data[key] = {
			   value: newValue, elem: document.createElement('div')
			};
			this.data[key].elem.appendChild(
			   document.createTextNode(key+': ')
			);
			this.data[key].elem.appendChild(newTextNode);
		}

		this.messageDiv.appendChild(this.data[key].elem);
	}
}
DebugWindow.prototype.hide = function() {
	this.pane.style.display = 'none';
	this.data = {};
}

window.debugWindow = new DebugWindow();
</script>
</html>
Do you see the bug in the latest nightly trunk build?
http://mozilla.isc.org/pub/mozilla.org/firefox/nightly/latest-trunk/
Yes, I do.
Ah, this is a dragging operation, you're talking about, right?
In that case, indeed, a mouseup event is not fired.
Probably related to bug 180514.
Component: General → DOM: Events
Product: Firefox → Core
Version: unspecified → Trunk
Yeah, bug 180514 does appear to be related. Maybe all mouse events after
"mousedown" are halted once certain criteria are met?

A difference between this bug and that one is that here, the cursor changes to a
circle with a slash.
Depends on: 180514
I have also independently confirmed this in another piece of code that I'm working on. If the mousedown occurs in a 'position: relative' element, the 'mouseover' handler I have installed on the document element doesn't receive any events. If I absolutely position the element, it works.

It looks like once the mousedown happens, that's it - no more events.
William, probably not related to this bug.
Please, file a new bug, and preferably with a testcase that shows the bug, ok?
Assignee: nobody → events
QA Contact: general → ian
Assignee: events → nobody
QA Contact: ian → events
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.