Improve an awkward initialization behavior in Javelin in Firefox

Summary: See comment; see IRC. This didn't cause anything bad, but ended up with `document.body.id == "null"` in Firefox, which is a bit weird.

Test Plan: Loaded page, put `document.body.null` into the console, got consistent results.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D7288
This commit is contained in:
epriestley
2013-10-12 17:08:56 -07:00
parent 122f643d6f
commit a0913db5df
2 changed files with 7 additions and 5 deletions

View File

@@ -2600,7 +2600,7 @@ celerity_register_resource_map(array(
),
'javelin-magical-init' =>
array(
'uri' => '/res/7c6c8d5a/rsrc/externals/javelin/core/init.js',
'uri' => '/res/374d1f02/rsrc/externals/javelin/core/init.js',
'type' => 'js',
'requires' =>
array(

View File

@@ -67,13 +67,15 @@
for (var ii = 0; ii < local_queue.length; ++ii) {
var evt = local_queue[ii];
// Sometimes IE gives us events which throw when ".type" is accessed;
// just ignore them since we can't meaningfully dispatch them. TODO:
// figure out where these are coming from.
// Sometimes IE gives us events which throw when ".type" is accessed;
// just ignore them since we can't meaningfully dispatch them. TODO:
// figure out where these are coming from.
try { var test = evt.type; } catch (x) { continue; }
if (!loaded && evt.type == 'domready') {
document.body && (document.body.id = null);
// NOTE: Firefox interprets "document.body.id = null" as the string
// literal "null".
document.body && (document.body.id = '');
loaded = true;
for (var jj = 0; jj < onload.length; jj++) {
onload[jj]();