1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-11 01:04:12 +01:00

Only fire the DOMLoad autocommand for the top level document.

This matches the PageLoad autocommand behaviour.
This commit is contained in:
Doug Kearns
2009-07-11 15:29:53 +10:00
parent 363cefe30f
commit 76a096e36b

View File

@@ -510,8 +510,9 @@ function Events() //{{{
function onDOMContentLoaded(event)
{
if (event.originalTarget instanceof HTMLDocument)
triggerLoadAutocmd("DOMLoad", event.originalTarget);
let doc = event.originalTarget;
if (doc instanceof HTMLDocument && !doc.defaultView.frameElement)
triggerLoadAutocmd("DOMLoad", doc);
}
// TODO: see what can be moved to onDOMContentLoaded()
@@ -532,9 +533,6 @@ function Events() //{{{
// code which should happen for all (also background) newly loaded tabs goes here:
let url = doc.location.href;
let title = doc.title;
// mark the buffer as loaded, we can't use buffer.loaded
// since that always refers to the current buffer, while doc can be
// any buffer, even in a background tab
@@ -555,7 +553,7 @@ function Events() //{{{
}
}
else // background tab
liberator.echomsg("Background tab loaded: " + title || url, 3);
liberator.echomsg("Background tab loaded: " + doc.title || doc.location.href, 3);
triggerLoadAutocmd("PageLoad", doc);
}