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