Thread (16 messages) flat view 16 messages, 1 author, 2016-06-15

Re: [PATCHv2/RFC 10/11] gitweb.js: Add UI for selecting common timezone to display dates

From: Jakub Narebski <hidden>
Date: 2016-06-15 22:51:03

On Fri, 15 Apr 2011, Jakub Narebski wrote:
KNOWN BUGS:
===========
* Timezone selection doesn't work in Chromium 6.0.472.62 (59676) and
  Google Chrome 10.0.648.204:

  Uncaught Error: NOT_FOUND_ERR: DOM Exception 8
    removeChangeTZForm
    /gitweb-static/gitweb.js:785
  onTZFormChange

  line 785: var removed = container.removeChild(popup);

  It works in Mozilla 1.17.2, Konqueror 3.5.3, Firefox 3.6.15, 3.6.16
  and 4.0, Internet Explorer 8.0, Opera 10.63.
Something strange is happening here.  removeChangeTZForm looks like this:

  function removeChangeTZForm(documentFragment, target, tzClassName) {
	// find containing element, where we appended timezone selection UI
	// `target' is somewhere inside timezone menu
	var container = target.parentNode, popup = target;
	while (container &&
	       container.className !== tzClassName) {
		popup = container;
		container = container.parentNode;
	}
	// safety check if we found correct container,
	// and if it isn't deleted already
	if (!container || !popup ||
	    container.className !== tzClassName ||
	    popup.className     !== 'popup') {
		return documentFragment;
	}

	// timezone selection UI was appended as last child
	// see also displayChangeTZForm function
	var removed = container.removeChild(popup); // <--- !!! here Chrome throws exception !!!
	if (documentFragment.firstChild !== removed) { // the only child
		// re-append it so it would be available for next time
		documentFragment.appendChild(removed);
	}
	// all of inline style was added by this script
	container.removeAttribute('style');

	return documentFragment;
  }

Note that from above code one would assume that after first loop we
would assert that we always have  popup.parentNode === contained.
When working with JavaScript debugger in Google Chrome I have found
that at the time that exception is thrown popup.parentNode is
DocumentFragment, not HTMLElement / HTMLSpanElement.

Something strange is going there.  I'd check if not setting 'onblur'
event handler (which doesn't work as expected anyway) would help.

-- 
Jakub Narebski
Poland
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help