git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Jakub Narebski <jnareb@gmail.com>
Date
Apr 15, 2011, 17:43 UTC
Message-ID
<201104151943.11537.jnareb@gmail.com>
In-Reply-To
<1302878645-458-11-git-send-email-jnareb@gmail.com>
On Fri, 15 Apr 2011, Jakub Narebski wrote:
Show 14 quoted lines
> 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
Previous: Jakub NarebskiNext: Jakub Narebski
Message 12 of 21 in “[PATCHv2 00/11] gitweb: Change timezone in dates using JavaScript”
  1. Jakub NarebskiApr 15, 2011
  2. 01/11 gitweb: Split JavaScript for maintability, combining on buildJakub Narebski, Apr 15, 2011
  3. 02/11 gitweb.js: Update and improve comments in JavaScript filesJakub Narebski, Apr 15, 2011
  4. 03/11 gitweb.js: Provide default values for padding in padLeftStr and padLeftJakub Narebski, Apr 15, 2011
  5. 04/11 gitweb.js: Extract and improve datetime handlingJakub Narebski, Apr 15, 2011
  6. 05/11 gitweb.js: Introduce gitweb/static/js/lib/cookies.jsJakub Narebski, Apr 15, 2011
  7. 06/11 gitweb.js: Provide getElementsByClassName method (if it not exists)Jakub Narebski, Apr 15, 2011
  8. 07/11 gitweb: Refactor generating of long dates into format_timestamp_htmlJakub Narebski, Apr 15, 2011
  9. 08/11 gitweb: Unify the way long timestamp is displayedJakub Narebski, Apr 15, 2011
  10. 09/11 gitweb: JavaScript ability to adjust time based on timezoneJakub Narebski, Apr 15, 2011
  11. 10/11 gitweb.js: Add UI for selecting common timezone to display datesJakub Narebski, Apr 15, 2011
  12. Jakub NarebskiApr 15, 2011
  13. Jakub NarebskiApr 15, 2011
  14. 10/11 gitweb.js: Add UI for selecting common timezone to display datesJakub Narebski, Apr 15, 2011
  15. 11/11 gitweb: Make JavaScript ability to adjust timezones configurableJakub Narebski, Apr 15, 2011
  16. Junio C HamanoApr 19, 2011
  17. Jakub NarebskiApr 19, 2011
  18. Jakub NarebskiApr 19, 2011
  19. Junio C HamanoApr 19, 2011
  20. 12/11 Remove gitweb/gitweb.cgi and other legacy targets from main MakefileJakub Narebski, Apr 19, 2011
  21. 01/11 git-instaweb: Simplify build dependency on gitwebJakub Narebski, Apr 19, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.