]> Lady’s Gitweb - Gitweb/commit
gitweb.js: Harden setting blamed commit info in incremental blame
authorJakub Narebski <redacted>
Wed, 25 Nov 2009 00:45:15 +0000 (01:45 +0100)
committerLady <redacted>
Mon, 6 Apr 2026 04:50:39 +0000 (00:50 -0400)
commit3e2dac3f3df399d9563822ef1ed90bb5a776d39e49e00d1f2d6a7133a9ed3afb
tree338c847266c52802b9747cadb8a916b43a2edc85e5848d49d16dfb48cb2186cc
parent367f1aa76008d203d3ef9f2ec5580a750d45c854823d513a9e45bcd5b6caa8f9
gitweb.js: Harden setting blamed commit info in incremental blame

Internet Explorer 8 stops at beginning of blame filling with the
following bug:

  "firstChild is null or not an object"

at this line:

  a_sha1.firstChild.data = commit.sha1.substr(0, 8);

It is (probably) caused by the fact that while a_sha1 element, which
looks like this:

  <a href=""> </a>

It has a firstChild which is a text node containing only whitespace
(single space character) in other web browsers (Firefox 3.5, Opera 10,
Google Chrome 3.0), IE8 clobbers DOM, removing trailing/leading
whitespace.

Protect against this bug by creating text element if it does not
exist.

Found-by: Stephen Boyd <redacted>
Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.js
This page took 0.283892 seconds and 4 git commands to generate.